Skip to content

Commit

Permalink
Scroll full pages with mouse wheel
Browse files Browse the repository at this point in the history
When using the scroll wheel over a page, holding Shift will cause full
pages to be scrolled instead of scroll steps. The same effect can be
achieved by scrolling over the vertical scrollbar.
  • Loading branch information
rodarima committed Oct 13, 2024
1 parent 1f7e5f5 commit 667f7fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/user_help.in.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ <h3 id="scrolling">Scrolling</h3>
<li>Using the <em>mouse</em> or <em>pointing device</em>:
<ul>
<li>Rotate the mouse wheel to move one <em>step</em> in that direction.
Hold Shift to move one <em>page</em> instead.
<li>Keep the middle button (or mouse wheel button) pressed while
dragging to scroll the page precisely.
</ul>
Expand All @@ -202,6 +203,8 @@ <h3 id="scrolling">Scrolling</h3>
specific position of the page.
<li>Click the scrollbar arrows to move the view one <em>step</em> in
that direction.
<li>Rotate the mouse wheel over the vertical scrollbar to move one
<em>page</em> in that direction.
</ul>
</li>
</ul>
Expand Down
10 changes: 10 additions & 0 deletions dw/fltkviewport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,16 @@ int FltkViewport::handle (int event)
break;

case FL_MOUSEWHEEL:
if ((vscrollbar->visible() && Fl::event_inside(vscrollbar)) ||
Fl::event_shift()) {
if (Fl::event_dy() > 0) {
scroll(core::SCREEN_DOWN_CMD);
return 1;
} else if (Fl::event_dy() < 0) {
scroll(core::SCREEN_UP_CMD);
return 1;
}
}
return (Fl::event_dx() ? hscrollbar : vscrollbar)->handle(event);
break;

Expand Down

0 comments on commit 667f7fd

Please sign in to comment.