summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2024-10-14 20:08:44 +0200
committerRodrigo Arias Mallo <rodarima@gmail.com>2024-10-14 20:08:44 +0200
commit3364967f2542cc0ad33509f6afcf34984cb0f3c8 (patch)
tree97b3f27bdd755c589e1fb1cadb7fa1848c53421b
parente4041a2f0fa8052028ac3bfa5b9b600a0f7fe7c4 (diff)
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.
-rw-r--r--dw/fltkviewport.cc10
1 files changed, 6 insertions, 4 deletions
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) {