Properly enforce zoom bounds again when changing zoom
authorWuzzy <Wuzzy2@mail.ru>
Tue, 05 Feb 2019 03:09:50 +0100
changeset 14701 d74517fdb34f
parent 14700 4eaeba349179
child 14702 bd43e703608b
Properly enforce zoom bounds again when changing zoom
hedgewars/uCommandHandlers.pas
--- a/hedgewars/uCommandHandlers.pas	Tue Feb 05 02:46:41 2019 +0100
+++ b/hedgewars/uCommandHandlers.pas	Tue Feb 05 03:09:50 2019 +0100
@@ -732,21 +732,23 @@
 procedure chZoomIn(var s: shortstring);
 begin
     s:= s; // avoid compiler hint
-    if ZoomValue < cMinZoomLevel then
-        if (LocalMessage and gmPrecise <> 0) then
-            ZoomValue:= ZoomValue + cZoomDeltaSmall
-        else
-            ZoomValue:= ZoomValue + cZoomDelta;
+    if (LocalMessage and gmPrecise <> 0) then
+        ZoomValue:= ZoomValue + cZoomDeltaSmall
+    else
+        ZoomValue:= ZoomValue + cZoomDelta;
+    if ZoomValue > cMinZoomLevel then
+        ZoomValue:= cMinZoomLevel;
 end;
 
 procedure chZoomOut(var s: shortstring);
 begin
     s:= s; // avoid compiler hint
-    if ZoomValue > cMaxZoomLevel then
-        if (LocalMessage and gmPrecise <> 0) then
-            ZoomValue:= ZoomValue - cZoomDeltaSmall
-        else
-            ZoomValue:= ZoomValue - cZoomDelta;
+    if (LocalMessage and gmPrecise <> 0) then
+        ZoomValue:= ZoomValue - cZoomDeltaSmall
+    else
+        ZoomValue:= ZoomValue - cZoomDelta;
+    if ZoomValue < cMaxZoomLevel then
+        ZoomValue:= cMaxZoomLevel;
 end;
 
 procedure chZoomReset(var s: shortstring);