diff options
Diffstat (limited to 'src/ui/scrollpane.cc')
-rw-r--r-- | src/ui/scrollpane.cc | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/ui/scrollpane.cc b/src/ui/scrollpane.cc index 48391c5..57c957f 100644 --- a/src/ui/scrollpane.cc +++ b/src/ui/scrollpane.cc @@ -65,24 +65,21 @@ void ScrollPane::set_offset(const int offset) scrollpane_offset = offset; } -bool ScrollPane::on_keypress(const int key, const unsigned int modifier) +bool ScrollPane::on_mousewheel(const math::Vector2f & direction) { // number of lines to scroll int alignmentmodifier =( (alignment() & AlignTop) == AlignTop) ? -1 : 1; - switch (key) { - - case 512 + SDL_BUTTON_WHEELUP: - inc_scroll(alignmentmodifier * scrollpane_offset); - return true; - break; - - case 512 + SDL_BUTTON_WHEELDOWN: - dec_scroll(alignmentmodifier * scrollpane_offset); - return true; - break; + if (direction.y() > 0 ) + { + inc_scroll(alignmentmodifier * scrollpane_offset); + return true; + } else if (direction.y() < 0 ) + { + dec_scroll(alignmentmodifier * scrollpane_offset); + return true; } - + return false; } |