summaryrefslogtreecommitdiff
path: root/src/viewport.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/viewport.cpp')
-rw-r--r--src/viewport.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp
index da4ed2660..5e72aaa23 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -1813,8 +1813,8 @@ void UpdateViewportPosition(Window *w)
if (_settings_client.gui.smooth_scroll) {
int max_scroll = ScaleByMapSize1D(512 * ZOOM_LVL_BASE);
/* Not at our desired position yet... */
- w->viewport->scrollpos_x += Clamp(delta_x / 4, -max_scroll, max_scroll);
- w->viewport->scrollpos_y += Clamp(delta_y / 4, -max_scroll, max_scroll);
+ w->viewport->scrollpos_x += Clamp(DivAwayFromZero(delta_x, 4), -max_scroll, max_scroll);
+ w->viewport->scrollpos_y += Clamp(DivAwayFromZero(delta_y, 4), -max_scroll, max_scroll);
} else {
w->viewport->scrollpos_x = w->viewport->dest_scrollpos_x;
w->viewport->scrollpos_y = w->viewport->dest_scrollpos_y;