From fd0aa3dd19ce9645a14c7e1c1dd698986ae5bede Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Fri, 22 Dec 2023 15:23:42 +0000 Subject: [PATCH] Fix #11515: Zoom level could wrap around when changing interface scale. (#11615) This happened due to converting the new value to unsigned before clamping instead of after. --- src/gfx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gfx.cpp b/src/gfx.cpp index 4b1373cfcd..3896647611 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -2005,7 +2005,7 @@ bool AdjustGUIZoom(bool automatic) w->top = (w->top * _gui_scale) / old_scale; } if (w->viewport != nullptr) { - w->viewport->zoom = Clamp(ZoomLevel(w->viewport->zoom - zoom_shift), _settings_client.gui.zoom_min, _settings_client.gui.zoom_max); + w->viewport->zoom = static_cast(Clamp(w->viewport->zoom - zoom_shift, _settings_client.gui.zoom_min, _settings_client.gui.zoom_max)); } }