Skip to content

viewport: Keep scroll position in percent

Benjamin Otte requested to merge wip/otte/viewport-position into main

Previously, the code tried to keep the absolute scroll position unchanged, which meant that when the child or the viewport changed size, the top left of the viewport would keep locked to the same coordinate in the child.

With the new code, we keep the point of the viewport unchanged that matches the percentage the scrollbar has been scrolled.

In particular, that means a centered child stays centered and a child stays at the bottom (or top) when the scrollbar is scolled to the end (or start, like before).

Merge request reports