Record whether a mouse click is continued or not

This commit is contained in:
2022-06-22 17:02:57 +01:00
parent ac0948cb64
commit 698ccb414d
18 changed files with 350 additions and 335 deletions
+7 -5
View File
@@ -67,10 +67,12 @@ handleMouseMotionEvent mmev u = Just $ u & uvWorld . mousePos .~ V2
handleMouseButtonEvent :: MouseButtonEventData -> World -> World
handleMouseButtonEvent mbev = case mouseButtonEventMotion mbev of
Released -> mouseButtons %~ S.delete thebutton
Pressed -> handlePressedMouseButton thebutton . (mouseButtons %~ S.insert thebutton)
Released -> mouseButtons . at thebutton .~ Nothing
Pressed -> handlePressedMouseButton thebutton . (mouseButtons . at thebutton %~ f)
where
thebutton = mouseButtonEventButton mbev
f Nothing = Just False
f _ = Just True
{- | Sets window position in config. -}
handleWindowMoveEvent :: WindowMovedEventData -> Universe -> Maybe Universe
@@ -106,7 +108,7 @@ handlePressedMouseButton but w = case (_hudElement (_hud w), but) of
_ -> w
where
maybeexitcombine
| ButtonRight `S.member` _mouseButtons w = id
| ButtonRight `M.member` _mouseButtons w = id
| otherwise = hud . hudElement .~ DisplayInventory NoSubInventory
-- note "sort" on the inventory indices; otherwise
@@ -177,8 +179,8 @@ wheelEvent y w = case _hudElement $ _hud w of
numcombs = length $ combineItemListYou w
yi = round $ signum y
numLocs = (fst . IM.findMax $ _seenLocations w) + 1
rbDown = ButtonRight `S.member` _mouseButtons w
lbDown = ButtonLeft `S.member` _mouseButtons w
rbDown = ButtonRight `M.member` _mouseButtons w
lbDown = ButtonLeft `M.member` _mouseButtons w
invKeyDown = ScancodeCapsLock `S.member` _keys w
getArguments' :: TerminalCommand -> Terminal -> World -> [String]