diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/documentwidget.c | 10 | ||||
-rw-r--r-- | src/ui/util.c | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 13f21df6..f1506fc3 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -947,6 +947,9 @@ static void refreshWhileScrolling_DocumentWidget_(iAny *ptr) { | |||
947 | } | 947 | } |
948 | 948 | ||
949 | static void smoothScroll_DocumentWidget_(iDocumentWidget *d, int offset, int duration) { | 949 | static void smoothScroll_DocumentWidget_(iDocumentWidget *d, int offset, int duration) { |
950 | if (!prefs_App()->smoothScrolling) { | ||
951 | duration = 0; /* always instant */ | ||
952 | } | ||
950 | int destY = targetValue_Anim(&d->scrollY) + offset; | 953 | int destY = targetValue_Anim(&d->scrollY) + offset; |
951 | if (destY < 0) { | 954 | if (destY < 0) { |
952 | destY = 0; | 955 | destY = 0; |
@@ -958,7 +961,12 @@ static void smoothScroll_DocumentWidget_(iDocumentWidget *d, int offset, int dur | |||
958 | else { | 961 | else { |
959 | destY = 0; | 962 | destY = 0; |
960 | } | 963 | } |
961 | setValueEased_Anim(&d->scrollY, destY, duration); | 964 | if (duration) { |
965 | setValueEased_Anim(&d->scrollY, destY, duration); | ||
966 | } | ||
967 | else { | ||
968 | setValue_Anim(&d->scrollY, destY, 0); | ||
969 | } | ||
962 | updateVisible_DocumentWidget_(d); | 970 | updateVisible_DocumentWidget_(d); |
963 | refresh_Widget(as_Widget(d)); | 971 | refresh_Widget(as_Widget(d)); |
964 | if (duration > 0) { | 972 | if (duration > 0) { |
diff --git a/src/ui/util.c b/src/ui/util.c index ceab01b8..e65e089d 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -188,7 +188,7 @@ static float valueAt_Anim_(const iAnim *d, const uint32_t now) { | |||
188 | void setValue_Anim(iAnim *d, float to, uint32_t span) { | 188 | void setValue_Anim(iAnim *d, float to, uint32_t span) { |
189 | if (span == 0) { | 189 | if (span == 0) { |
190 | d->from = d->to = to; | 190 | d->from = d->to = to; |
191 | d->when = d->due = SDL_GetTicks(); | 191 | d->when = d->due = frameTime_Window(get_Window()); /* effectively in the past */ |
192 | } | 192 | } |
193 | else if (fabsf(to - d->to) > 0.00001f) { | 193 | else if (fabsf(to - d->to) > 0.00001f) { |
194 | const uint32_t now = SDL_GetTicks(); | 194 | const uint32_t now = SDL_GetTicks(); |
@@ -997,6 +997,8 @@ iWidget *makePreferences_Widget(void) { | |||
997 | setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.downloads"); | 997 | setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.downloads"); |
998 | addChild_Widget(headings, iClob(makeHeading_Widget("Outline on scrollbar:"))); | 998 | addChild_Widget(headings, iClob(makeHeading_Widget("Outline on scrollbar:"))); |
999 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.hoveroutline"))); | 999 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.hoveroutline"))); |
1000 | addChild_Widget(headings, iClob(makeHeading_Widget("Smooth scrolling:"))); | ||
1001 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.smoothscroll"))); | ||
1000 | makeTwoColumnHeading_("WINDOW", headings, values); | 1002 | makeTwoColumnHeading_("WINDOW", headings, values); |
1001 | #if defined (iPlatformApple) || defined (iPlatformMSys) | 1003 | #if defined (iPlatformApple) || defined (iPlatformMSys) |
1002 | addChild_Widget(headings, iClob(makeHeading_Widget("Use system theme:"))); | 1004 | addChild_Widget(headings, iClob(makeHeading_Widget("Use system theme:"))); |