Fix zoom bug

This commit is contained in:
2023-05-01 14:27:49 +01:00
parent 60e5e6ecae
commit 7b8b8750a9
2 changed files with 23 additions and 33 deletions
+1 -1
View File
@@ -56,5 +56,5 @@ chaseCritVocalization =
, seagullCry1S , seagullCry1S
, seagullCry2S , seagullCry2S
] ]
(50,100) (50, 200)
0 0
+8 -18
View File
@@ -159,28 +159,18 @@ zoomSpeed :: Float
zoomSpeed = 39 / 40 zoomSpeed = 39 / 40
zoomInLongGun :: Point2 -> Scope -> Scope zoomInLongGun :: Point2 -> Scope -> Scope
zoomInLongGun mousep sc zoomInLongGun mousep sc = fromMaybe sc $ do
| currentZoom < 8 = curzoom <- sc ^? scopeZoom
sc guard $ curzoom < 8
& scopePos .+.+~ (1 - zoomSpeed) / newzoom *.* mousep return $ sc & scopePos .+.+~ (1 - zoomSpeed)*zoomSpeed/curzoom *.* mousep
& scopeZoom %~ (/ zoomSpeed) & scopeZoom %~ (/ zoomSpeed)
| otherwise = sc
where
Just currentZoom = sc ^? scopeZoom
newzoom = (sc ^?! scopeZoom) / zoomSpeed
zoomOutLongGun :: Scope -> Scope zoomOutLongGun :: Scope -> Scope
zoomOutLongGun sc zoomOutLongGun sc = fromMaybe sc $ do
| currentzoom > 0.5 = curzoom <- sc ^? scopeZoom
sc guard $ curzoom > 0.5
& scopePos %~ (\p -> p +.+ (zoomSpeed-1) / currentzoom *.* p) return $ sc & scopePos %~ (\p -> p +.+ (zoomSpeed - 1) / curzoom *.* p)
-- & scopePos .*.*~ 1 - ((newzoom * 2) ** zoomSpeed)
& scopeZoom *~ zoomSpeed & scopeZoom *~ zoomSpeed
| otherwise = sc
& scopePos .~ V2 0 0
where
Just currentzoom = sc ^? scopeZoom
--newzoom = (sc ^?! scopeZoom) / zoomSpeed
ifConfigWallRotate :: Configuration -> World -> World ifConfigWallRotate :: Configuration -> World -> World
ifConfigWallRotate cfig w ifConfigWallRotate cfig w