This commit is contained in:
2024-11-25 19:49:16 +00:00
parent 51caf936f4
commit 8ad91c7bac
4 changed files with 7 additions and 11 deletions
+1 -1
View File
@@ -1 +1 @@
All good (594 modules, at 18:51:13) All good (594 modules, at 19:44:22)
+1 -1
View File
@@ -27,7 +27,7 @@ data MouseContext
, _mcoAboveSelect :: Maybe (Int,Int) , _mcoAboveSelect :: Maybe (Int,Int)
, _mcoBelowSelect :: Maybe (Int,Int) , _mcoBelowSelect :: Maybe (Int,Int)
} }
| OverInvDragSelect { _mcoSelStart :: (Int,Int), _mcoSelEnd :: Maybe (Int,Int) } | OverInvDragSelect { _mcoSecSelStart :: (Int,Int), _mcoSelEnd :: Maybe Int }
| OverInvSelect { _mcoInvSelect :: (Int,Int)} | OverInvSelect { _mcoInvSelect :: (Int,Int)}
| OverInvFilt { _mcoInvFilt :: (Int,Int)} | OverInvFilt { _mcoInvFilt :: (Int,Int)}
| OverCombSelect { _mcoCombSelect :: (Int,Int)} | OverCombSelect { _mcoCombSelect :: (Int,Int)}
+1 -2
View File
@@ -144,8 +144,7 @@ drawDragSelected cfig w = do
drawDragSelecting :: Configuration -> World -> Maybe Picture drawDragSelecting :: Configuration -> World -> Maybe Picture
drawDragSelecting cfig w = do drawDragSelecting cfig w = do
OverInvDragSelect (i, j) mselend <- w ^? input . mouseContext OverInvDragSelect (i, j) mselend <- w ^? input . mouseContext
(a, b) <- mselend b <- mselend
guard $ i == a
sss <- w ^? hud . hudElement . diSections sss <- w ^? hud . hudElement . diSections
let idp = invDisplayParams w let idp = invDisplayParams w
let f x = selSecDrawCursorAt 15 idp BackdropCursor sss (i, x) let f x = selSecDrawCursorAt 15 idp BackdropCursor sss (i, x)
+4 -7
View File
@@ -93,7 +93,7 @@ updateMouseHeldInGame cfig w = case w ^. input . mouseContext of
sss <- w ^? hud . hudElement . diSections sss <- w ^? hud . hudElement . diSections
let msel = inverseSelNumPos cfig ldp sss (w ^. input . mousePos) let msel = inverseSelNumPos cfig ldp sss (w ^. input . mousePos)
guard $ Just (fst sstart) == fmap fst msel || isNothing msel guard $ Just (fst sstart) == fmap fst msel || isNothing msel
return $ w & input . mouseContext . mcoSelEnd .~ msel return $ w & input . mouseContext . mcoSelEnd .~ fmap snd msel
OverInvDrag k mmouseover ab bn -> fromMaybe w $ do OverInvDrag k mmouseover ab bn -> fromMaybe w $ do
ss <- w ^? hud . hudElement . diSections . ix k . ssItems ss <- w ^? hud . hudElement . diSections . ix k . ssItems
x <- mmouseover x <- mmouseover
@@ -144,16 +144,13 @@ updateMouseReleaseInGame w = case w ^. input . mouseContext of
& hud . hudElement . diSelection . _Just . _3 %~ getuniques & hud . hudElement . diSelection . _Just . _3 %~ getuniques
(maybe mempty (h ssel) (maybe mempty (h ssel)
(guard (ssel ^? _1 == w ^? hud . hudElement . diSelection . _Just . _1) (guard (ssel ^? _1 == w ^? hud . hudElement . diSelection . _Just . _1)
>> mesel ^? _Just . _2)) >> mesel ^? _Just))
-- note this assumes that mesel isn't outside the first
-- selection, this should perhaps just be made impossible by
-- removing the first part of the tuple
OverInvDragSelect _ Nothing -> OverInvDragSelect _ Nothing ->
w & input . mouseContext .~ MouseInGame w & input . mouseContext .~ MouseInGame
& hud . hudElement . diSelection . _Just . _3 %~ const mempty & hud . hudElement . diSelection . _Just . _3 %~ const mempty
OverInvDragSelect ssel (Just esel) -> OverInvDragSelect ssel (Just esel) ->
w & input . mouseContext .~ MouseInGame w & input . mouseContext .~ MouseInGame
& augInvDirectSelect (f (min ssel esel) (h ssel (snd esel))) & augInvDirectSelect (f (min ssel (fst ssel,esel)) (h ssel esel))
_ -> w _ -> w
where where
getuniques x y = IS.union x y IS.\\ IS.intersection x y getuniques x y = IS.union x y IS.\\ IS.intersection x y
@@ -173,7 +170,7 @@ updateMouseClickInGame cfig w = case w ^. input . mouseContext of
w & input . mouseContext w & input . mouseContext
.~ OverInvDragSelect ysel Nothing .~ OverInvDragSelect ysel Nothing
OverInvSelect x | ScancodeLShift `M.member` (w ^. input . pressedKeys ) OverInvSelect x | ScancodeLShift `M.member` (w ^. input . pressedKeys )
-> w & input . mouseContext .~ OverInvDragSelect x (Just x) -> w & input . mouseContext .~ OverInvDragSelect x (Just $ snd x)
OverInvSelect x -> startDrag x cfig w OverInvSelect x -> startDrag x cfig w
OverTerminalReturn tmid -> terminalReturnEffect tmid w OverTerminalReturn tmid -> terminalReturnEffect tmid w
OverTerminalEscape -> OverTerminalEscape ->