Skip to content

Commit

Permalink
Take into account the scrollbar in page overlap
Browse files Browse the repository at this point in the history
When the horizontal scrollbar is visible the viewport size is reduced,
so the page overlap should be computed from the visible viewport only.
The change ensures the overlap has the same lenght, regardless of the
visibility state of the scrollbars.
  • Loading branch information
rodarima committed Oct 14, 2024
1 parent e4041a2 commit 3364967
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions dw/fltkviewport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -526,14 +526,16 @@ void FltkViewport::scroll (int dx, int dy)

void FltkViewport::scroll (core::ScrollCommand cmd)
{
int hdiff = vscrollbar->visible () ? SCROLLBAR_THICKNESS : 0;
int vdiff = hscrollbar->visible () ? SCROLLBAR_THICKNESS : 0;
if (cmd == core::SCREEN_UP_CMD) {
scroll (0, -h () + pageOverlap);
scroll (0, -h () + pageOverlap + vdiff);
} else if (cmd == core::SCREEN_DOWN_CMD) {
scroll (0, h () - pageOverlap);
scroll (0, h () - pageOverlap - vdiff);
} else if (cmd == core::SCREEN_LEFT_CMD) {
scroll (-w() + pageOverlap, 0);
scroll (-w() + pageOverlap + hdiff, 0);
} else if (cmd == core::SCREEN_RIGHT_CMD) {
scroll (w() - pageOverlap, 0);
scroll (w() - pageOverlap - hdiff, 0);
} else if (cmd == core::LINE_UP_CMD) {
scroll (0, -vscrollbar->linesize ());
} else if (cmd == core::LINE_DOWN_CMD) {
Expand Down

0 comments on commit 3364967

Please sign in to comment.