diff options
Diffstat (limited to 'src/ui/widget.c')
-rw-r--r-- | src/ui/widget.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c index d8c2c421..4d50da38 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c | |||
@@ -572,6 +572,26 @@ iBool processEvent_Widget(iWidget *d, const SDL_Event *ev) { | |||
572 | postCommand_Widget(d, "mouse.moved coord:%d %d", ev->motion.x, ev->motion.y); | 572 | postCommand_Widget(d, "mouse.moved coord:%d %d", ev->motion.x, ev->motion.y); |
573 | return iTrue; | 573 | return iTrue; |
574 | } | 574 | } |
575 | else if (d->flags & overflowScrollable_WidgetFlag && ev->type == SDL_MOUSEWHEEL) { | ||
576 | iRect bounds = bounds_Widget(d); | ||
577 | const iInt2 winSize = rootSize_Window(get_Window()); | ||
578 | if (height_Rect(bounds) > winSize.y) { | ||
579 | int step = ev->wheel.y; | ||
580 | #if !defined (iPlatformApple) | ||
581 | step *= lineHeight_Text(uiLabel_FontId); | ||
582 | #endif | ||
583 | bounds.pos.y += step; | ||
584 | if (step > 0) { | ||
585 | bounds.pos.y = iMin(bounds.pos.y, 0); | ||
586 | } | ||
587 | else { | ||
588 | bounds.pos.y = iMax(bounds.pos.y, winSize.y - height_Rect(bounds)); | ||
589 | } | ||
590 | d->rect.pos = localCoord_Widget(d->parent, bounds.pos); | ||
591 | refresh_Widget(d); | ||
592 | return iTrue; | ||
593 | } | ||
594 | } | ||
575 | switch (ev->type) { | 595 | switch (ev->type) { |
576 | case SDL_USEREVENT: { | 596 | case SDL_USEREVENT: { |
577 | if (ev->user.code == command_UserEventCode && d->commandHandler && | 597 | if (ev->user.code == command_UserEventCode && d->commandHandler && |