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
+13 -13
View File
@@ -45,16 +45,16 @@ chaseCrit =
chaseCritVocalization :: Vocalization
chaseCritVocalization =
Vocalization
seagullChatterS
[ seagullBarkS
, seagullChatterS
, seagullChatter1S
, seagullWhistleS
, seagullWhistle1S
, seagullCryS
, seagullCry1S
, seagullCry2S
]
(50,100)
0
Vocalization
seagullChatterS
[ seagullBarkS
, seagullChatterS
, seagullChatter1S
, seagullWhistleS
, seagullWhistle1S
, seagullCryS
, seagullCry1S
, seagullCry2S
]
(50, 200)
0
+10 -20
View File
@@ -159,28 +159,18 @@ zoomSpeed :: Float
zoomSpeed = 39 / 40
zoomInLongGun :: Point2 -> Scope -> Scope
zoomInLongGun mousep sc
| currentZoom < 8 =
sc
& scopePos .+.+~ (1 - zoomSpeed) / newzoom *.* mousep
& scopeZoom %~ (/ zoomSpeed)
| otherwise = sc
where
Just currentZoom = sc ^? scopeZoom
newzoom = (sc ^?! scopeZoom) / zoomSpeed
zoomInLongGun mousep sc = fromMaybe sc $ do
curzoom <- sc ^? scopeZoom
guard $ curzoom < 8
return $ sc & scopePos .+.+~ (1 - zoomSpeed)*zoomSpeed/curzoom *.* mousep
& scopeZoom %~ (/ zoomSpeed)
zoomOutLongGun :: Scope -> Scope
zoomOutLongGun sc
| currentzoom > 0.5 =
sc
& scopePos %~ (\p -> p +.+ (zoomSpeed-1) / currentzoom *.* p)
-- & scopePos .*.*~ 1 - ((newzoom * 2) ** zoomSpeed)
& scopeZoom *~ zoomSpeed
| otherwise = sc
& scopePos .~ V2 0 0
where
Just currentzoom = sc ^? scopeZoom
--newzoom = (sc ^?! scopeZoom) / zoomSpeed
zoomOutLongGun sc = fromMaybe sc $ do
curzoom <- sc ^? scopeZoom
guard $ curzoom > 0.5
return $ sc & scopePos %~ (\p -> p +.+ (zoomSpeed - 1) / curzoom *.* p)
& scopeZoom *~ zoomSpeed
ifConfigWallRotate :: Configuration -> World -> World
ifConfigWallRotate cfig w