Tweak mouse context/cursors

This commit is contained in:
2024-11-15 22:53:33 +00:00
parent 4434093d81
commit 0621709f7b
7 changed files with 288 additions and 205 deletions
+24 -7
View File
@@ -389,19 +389,36 @@ shiftInvItemsDown (_, i) x w = fromMaybe w $ do
updateMouseContext :: Configuration -> World -> World
updateMouseContext cfig w =
w & input . mouseContext .~ fromMaybe NoMouseContext
w & input . mouseContext .~ fromMaybe aimcontext
(overinv <|> overcomb <|> overterm)
where
aimcontext
| ButtonRight `M.member` (w ^. input . mouseButtons) = MouseAiming
| otherwise = NoMouseContext
overinv = do
sss <- w ^? hud . hudElement . diSections
guard $
ButtonRight `M.notMember` (w ^. input . mouseButtons)
|| not (null $ w ^? hud . hudElement . subInventory . ciSelection)
fmap OverInv $ inverseSelNumPos cfig (invDisplayParams w) sss (w ^. input . mousePos)
selpos <- inverseSelNumPos cfig (invDisplayParams w) sss (w ^. input . mousePos)
case w ^? hud . hudElement . subInventory . ciSelection of
Just _ -> return $ OverInvFilt selpos
_ -> do
guard $ ButtonRight `M.notMember` (w ^. input . mouseButtons)
return $ OverInvSelect selpos
overcomb = do
sss <- w ^? hud . hudElement . subInventory . ciSections
fmap OverCombInv $ inverseSelNumPos cfig secondColumnParams sss (w ^. input . mousePos)
overterm = Nothing
msel <- w ^? hud . hudElement . subInventory . ciSelection . _Just
let mpossel = inverseSelNumPos cfig secondColumnParams sss (w ^. input . mousePos)
case mpossel of
Nothing -> usecsel msel
Just (-1,_) -> return OverCombFilter
Just x | x == msel -> return $ OverCombCombine x
Just x -> return $ OverCombSelect x
-- fmap OverCombCombine $ inverseSelNumPos cfig secondColumnParams sss (w ^. input . mousePos)
usecsel (-1,_) = return OverCombFilter
usecsel x = return $ OverCombCombine x
overterm = do
tmid <- w ^? hud . hudElement . subInventory . termID
guard True
return OverTerminalReturn
updateWheelEvents :: World -> World
updateWheelEvents w