Tweak mouse context/cursors
This commit is contained in:
+24
-7
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user