Re: zoom needs scrolling to maintain center

Rodrigo Arias <[email protected]>
Newsgroups gmane.comp.web.dillo.devel
Message-ID <[email protected]>
Hi,

On Fri, Jul 12, 2024 at 11:18:11PM +0200, [email protected] wrote:
>On Fri, 12 Jul 2024 12:04:30 -0600
>[email protected] wrote:
>
>> Hi
>>
>> with left mouse click on zoom button -> screen get bigger and screen
>> slides down - so when leaves the viewport it needs a scroll up so
>> center remains and zoom is userfull
>>
>> with right mouse click on zoom button -> screen get smaller and
>> screen slides down - so when viewport is off the physical screena
>> scroll down - do nothing when viewport is <= the physical screen
>
>Thats true. I think the zoom code right now just relies on a
>StyleEngine action, which isn't really designed for that. What you
>are suggesting would probably take quite a bit more work.

I think we could approximate it by assuming that each element will be 
magnified by the same amount.

Therefore, if you measure the distance in pixels of the current view 
from the top of the page, Y, and then you increase the zoom by a factor 
of 1.2, then you should scroll to 1.2*Y to compensate it. Here is a 
"graphical" visualization but in horizontal rather than vertically:

   0    5    10   15        0    5    10   15
   AAAABBBBCCCCDDDD   -->   AAAAABBBBBCCCCCDDDDD
             ^                          ^
             Y=10     x1.2              Y=12

This won't work with cases where the text is constrained into a 
container that has 100% width (or some other relative size), as it would 
change the breaking point of the lines, causing the scroll approximation 
to fail.

A more accurate and complex approach is to take the position of some 
elements in the current view, and then try to locate them after zooming 
and then scroll there.

I opened an issue here to track it:

https://github.com/dillo-browser/dillo/issues/221

Rodrigo.
_______________________________________________
Dillo-dev mailing list -- dillo-dev-lx9mn2B4QYRWk0Htik3J/[email protected]
To unsubscribe send an email to dillo-dev-leave-lx9mn2B4QYRWk0Htik3J/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.