summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2022-02-08 21:25:18 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2022-02-08 21:25:18 +0200
commitb708ac294e9237e73eb666db61b873ebb2740eb6 (patch)
tree970839ebb8232f162f2a2d512e0256c1f5cdbe2a
parent12a6fc81e8d11dc21db5938132818972df08e885 (diff)
Widget: Faster scrolling of long popups
Do the mouse hover scrolling faster for long popups.
-rw-r--r--src/ui/widget.c4
1 files 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) {
1290 /* TODO: Motion events occur frequently. Maybe it would help if these were handled 1290 /* TODO: Motion events occur frequently. Maybe it would help if these were handled
1291 via audiences that specifically register to listen for motion, to minimize the 1291 via audiences that specifically register to listen for motion, to minimize the
1292 number of widgets that need to process them. */ 1292 number of widgets that need to process them. */
1293 const int hoverScrollLimit = 1.5f * lineHeight_Text(default_FontId); 1293 const int hoverScrollLimit = 3.0f * lineHeight_Text(default_FontId);
1294 float speed = 0.0f; 1294 float speed = 0.0f;
1295 if (ev->motion.y < hoverScrollLimit) { 1295 if (ev->motion.y < hoverScrollLimit) {
1296 speed = (hoverScrollLimit - ev->motion.y) / (float) hoverScrollLimit; 1296 speed = (hoverScrollLimit - ev->motion.y) / (float) hoverScrollLimit;
@@ -1315,7 +1315,7 @@ iBool processEvent_Widget(iWidget *d, const SDL_Event *ev) {
1315 if (elapsed > 100) { 1315 if (elapsed > 100) {
1316 elapsed = 16; 1316 elapsed = 16;
1317 } 1317 }
1318 int step = elapsed * gap_UI / 16 * iClamp(speed, -1.0f, 1.0f); 1318 int step = elapsed * gap_UI / 8 * iClamp(speed, -1.0f, 1.0f);
1319 if (step != 0) { 1319 if (step != 0) {
1320 lastHoverOverflowMotionTime_ = nowTime; 1320 lastHoverOverflowMotionTime_ = nowTime;
1321 scrollOverflow_Widget(d, step); 1321 scrollOverflow_Widget(d, step);