From b708ac294e9237e73eb666db61b873ebb2740eb6 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Tue, 8 Feb 2022 21:25:18 +0200 Subject: Widget: Faster scrolling of long popups Do the mouse hover scrolling faster for long popups. --- src/ui/widget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/widget.c b/src/ui/widget.c index 9f67b1c7..fc754b7a 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c @@ -1290,7 +1290,7 @@ iBool processEvent_Widget(iWidget *d, const SDL_Event *ev) { /* TODO: Motion events occur frequently. Maybe it would help if these were handled via audiences that specifically register to listen for motion, to minimize the number of widgets that need to process them. */ - const int hoverScrollLimit = 1.5f * lineHeight_Text(default_FontId); + const int hoverScrollLimit = 3.0f * lineHeight_Text(default_FontId); float speed = 0.0f; if (ev->motion.y < hoverScrollLimit) { speed = (hoverScrollLimit - ev->motion.y) / (float) hoverScrollLimit; @@ -1315,7 +1315,7 @@ iBool processEvent_Widget(iWidget *d, const SDL_Event *ev) { if (elapsed > 100) { elapsed = 16; } - int step = elapsed * gap_UI / 16 * iClamp(speed, -1.0f, 1.0f); + int step = elapsed * gap_UI / 8 * iClamp(speed, -1.0f, 1.0f); if (step != 0) { lastHoverOverflowMotionTime_ = nowTime; scrollOverflow_Widget(d, step); -- cgit v1.2.3