Tweak camera movement

This commit is contained in:
2024-12-31 09:54:57 +00:00
parent e12e4777b2
commit ede08ff1db
6 changed files with 79 additions and 79 deletions
+6 -5
View File
@@ -2,19 +2,20 @@ module Dodge.Hotkey (
assignHotkey,
) where
import NewInt
import Control.Lens
import Data.Maybe
import Dodge.Data.World
import NewInt
-- it is not obvious to me whether hotkeys should belong to LWorld, CWorld or
-- World
assignHotkey :: NewInt ItmInt -> Hotkey -> LWorld -> LWorld
assignHotkey (NInt itid) hk lw = lw
& handleoldposition
& hotkeys . at hk ?~ NInt itid
& imHotkeys . unNIntMap . at itid ?~ hk
assignHotkey (NInt itid) hk lw =
lw
& handleoldposition
& hotkeys . at hk ?~ NInt itid
& imHotkeys . unNIntMap . at itid ?~ hk
where
handleoldposition = fromMaybe id $ do
olditid <- lw ^? hotkeys . ix hk . unNInt