From 3364967f2542cc0ad33509f6afcf34984cb0f3c8 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Mon, 14 Oct 2024 20:08:44 +0200 Subject: Take into account the scrollbar in page overlap 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. --- dw/fltkviewport.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'dw') diff --git a/dw/fltkviewport.cc b/dw/fltkviewport.cc index 86071128..d24703b2 100644 --- a/dw/fltkviewport.cc +++ b/dw/fltkviewport.cc @@ -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) { -- cgit v1.2.3