diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-10-13 14:22:14 +0200 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-10-13 16:18:41 +0200 |
commit | f73a9c1a1967318a33cc91f588552574dc7c3f01 (patch) | |
tree | 17725a28fd5719e052a74c27f722de545d0310a4 /dw/fltkviewport.cc | |
parent | 667f7fd713bc2d4f9196bc71e2b8ac8b2ca210f1 (diff) |
Control the page overlap independently
Introduces the new option scroll_page_overlap to control the amount of
pixels of overlap when scrolling to the next or previous page.
Previously this value was taken from scroll_step, but now they are
controlled independently.
Fixes: https://github.com/dillo-browser/dillo/issues/276
Diffstat (limited to 'dw/fltkviewport.cc')
-rw-r--r-- | dw/fltkviewport.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/dw/fltkviewport.cc b/dw/fltkviewport.cc index b8f4e51e..e9169495 100644 --- a/dw/fltkviewport.cc +++ b/dw/fltkviewport.cc @@ -73,6 +73,7 @@ FltkViewport::FltkViewport (int X, int Y, int W, int H, const char *label): scrollX = scrollY = scrollDX = scrollDY = 0; horScrolling = verScrolling = dragScrolling = 0; scrollbarPageMode = false; + pageOverlap = 50; gadgetOrientation[0] = GADGET_HORIZONTAL; gadgetOrientation[1] = GADGET_HORIZONTAL; @@ -434,6 +435,11 @@ void FltkViewport::setScrollStep(int step) hscrollbar->linesize(step); } +void FltkViewport::setPageOverlap(int overlap) +{ + pageOverlap = overlap; +} + void FltkViewport::setScrollbarPageMode(bool enable) { scrollbarPageMode = enable; @@ -493,13 +499,13 @@ void FltkViewport::scroll (int dx, int dy) void FltkViewport::scroll (core::ScrollCommand cmd) { if (cmd == core::SCREEN_UP_CMD) { - scroll (0, -h () + vscrollbar->linesize ()); + scroll (0, -h () + pageOverlap); } else if (cmd == core::SCREEN_DOWN_CMD) { - scroll (0, h () - vscrollbar->linesize ()); + scroll (0, h () - pageOverlap); } else if (cmd == core::SCREEN_LEFT_CMD) { - scroll (-w() + hscrollbar->linesize (), 0); + scroll (-w() + pageOverlap, 0); } else if (cmd == core::SCREEN_RIGHT_CMD) { - scroll (w() - hscrollbar->linesize (), 0); + scroll (w() - pageOverlap, 0); } else if (cmd == core::LINE_UP_CMD) { scroll (0, -vscrollbar->linesize ()); } else if (cmd == core::LINE_DOWN_CMD) { |