Lagrange [work/v1.10]

Adjusted smooth scroll speed when using mouse wheel

=> 0c99a388871a0c4c9102c162a65c03c2f3660cce

diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index bdf7d282..9e8e644e 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -1801,7 +1801,9 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e
         smoothScroll_DocumentWidget_(
             d,
             -3 * ev->wheel.y * lineHeight_Text(paragraph_FontId) * acceleration,
-            smoothDuration_DocumentWidget_);
+            smoothDuration_DocumentWidget_ *
+                (!isFinished_Anim(&d->scrollY) && pos_Anim(&d->scrollY) < 0.25f ? 0.5f : 1.0f));
+            /* accelerated speed for repeated wheelings */
 #endif
         iChangeFlags(d->flags, noHoverWhileScrolling_DocumentWidgetFlag, iTrue);
         return iTrue;
diff --git a/src/ui/util.c b/src/ui/util.c
index 27950c5e..603b3213 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -221,6 +221,10 @@ void stop_Anim(iAnim *d) {
     d->when = d->due = SDL_GetTicks();
 }
 
+float pos_Anim(const iAnim *d) {
+    return pos_Anim_(d, frameTime_Window(get_Window()));
+}
+
 float value_Anim(const iAnim *d) {
     return valueAt_Anim_(d, frameTime_Window(get_Window()));
 }
diff --git a/src/ui/util.h b/src/ui/util.h
index c342c095..9796b387 100644
--- a/src/ui/util.h
+++ b/src/ui/util.h
@@ -89,6 +89,7 @@ void    setFlags_Anim       (iAnim *, int flags, iBool set);
 void    stop_Anim           (iAnim *);
 
 iBool   isFinished_Anim     (const iAnim *);
+float   pos_Anim            (const iAnim *);
 float   value_Anim          (const iAnim *);
 
 iLocalDef float targetValue_Anim(const iAnim *d) {
Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.10/cdiff/0c99a388871a0c4c9102c162a65c03c2f3660cce
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
66.450269 milliseconds
Gemini-to-HTML Time
0.218394 milliseconds

This content has been proxied by September (ba2dc).