From 0c99a388871a0c4c9102c162a65c03c2f3660cce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= jaakko.keranen@iki.fi
Date: Sat, 24 Oct 2020 08:45:16 +0300
Subject: [PATCH 1/1] Adjusted smooth scroll speed when using mouse wheel
src/ui/documentwidget.c | 4 +++-
src/ui/util.c | 4 ++++
src/ui/util.h | 1 +
3 files changed, 8 insertions(+), 1 deletion(-)
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) {
+}
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) {
--
2.25.1
text/plain
This content has been proxied by September (ba2dc).