Fix cursor being too limited left/right if zoomed out too much
authorWuzzy <Wuzzy2@mail.ru>
Mon, 29 Jun 2020 14:08:19 +0200
changeset 15653 d738b2b1249e
parent 15652 3d8c2ab2b98b
child 15654 c1d0ada72cc8
Fix cursor being too limited left/right if zoomed out too much
hedgewars/uWorld.pas
--- a/hedgewars/uWorld.pas	Mon Jun 29 13:40:13 2020 +0200
+++ b/hedgewars/uWorld.pas	Mon Jun 29 14:08:19 2020 +0200
@@ -2017,16 +2017,16 @@
 if (CurrentTeam^.ExtDriven and isCursorVisible and autoCameraOn) or
    (not CurrentTeam^.ExtDriven and isCursorVisible) or ((FollowGear <> nil) and autoCameraOn) then
     begin
-    if CursorPoint.X < - cScreenWidth div 2 + EdgesDist then
+    if CursorPoint.X < - trunc(cScreenWidth / cScaleFactor) + EdgesDist then
         begin
-        WorldDx:= WorldDx - CursorPoint.X - cScreenWidth div 2 + EdgesDist;
-        CursorPoint.X:= - cScreenWidth div 2 + EdgesDist
+        WorldDx:= WorldDx - CursorPoint.X - trunc(cScreenWidth / cScaleFactor) + EdgesDist;
+        CursorPoint.X:= - trunc(cScreenWidth / cScaleFactor) + EdgesDist
         end
     else
-        if CursorPoint.X > cScreenWidth div 2 - EdgesDist then
+        if CursorPoint.X > trunc(cScreenWidth / cScaleFactor) - EdgesDist then
             begin
-            WorldDx:= WorldDx - CursorPoint.X + cScreenWidth div 2 - EdgesDist;
-            CursorPoint.X:= cScreenWidth div 2 - EdgesDist
+            WorldDx:= WorldDx - CursorPoint.X + trunc(cScreenWidth / cScaleFactor) - EdgesDist;
+            CursorPoint.X:= trunc(cScreenWidth / cScaleFactor) - EdgesDist
             end;
 
     shs:= min(cScreenHeight div 2 - trunc(cScreenHeight / cScaleFactor) + EdgesDist, cScreenHeight - EdgesDist);