Continue mouse refactor, add explicit release event/timer

This commit is contained in:
2024-11-19 12:00:31 +00:00
parent 5b709cd7ba
commit e31f6dfd4b
10 changed files with 97 additions and 75 deletions
+17 -9
View File
@@ -131,23 +131,31 @@ drawMouseOver cfig w = fromMaybe mempty $ invsel <|> combinvsel
. color (withAlpha 0.2 white)
$ selSecDrawCursorAt 15 idp curs sss (j, i)
getMouseInvSel :: World -> Maybe ((Int, Int), (Int, Int))
getMouseInvSel w = case w ^? hud . hudElement . subInventory . nsSelected of
Just (MouseInvSelect s (Just e)) -> Just (s, e)
_ -> case w ^? hud . hudElement . diSelectionExtra of
Just x | x > 0 -> do
(i, j) <- w ^? hud . hudElement . diSelection . _Just
return ((i, j), (i, j + x))
_ -> Nothing
--getMouseInvSel :: World -> Maybe ((Int, Int), (Int, Int))
--getMouseInvSel w = case w ^? hud . hudElement . subInventory . nsSelected of
-- Just (MouseInvSelect s (Just e)) -> Just (s, e)
-- _ -> case w ^? hud . hudElement . diSelectionExtra of
-- Just x | x > 0 -> do
-- (i, j) <- w ^? hud . hudElement . diSelection . _Just
-- return ((i, j), (i, j + x))
-- _ -> Nothing
drawDISelections :: World -> Picture
drawDISelections w = fromMaybe mempty $ do
((i, j), (a, b)) <- getMouseInvSel w
OverInvDragSelect (i,j) mselend <- w ^? input . mouseContext
(a,b) <- mselend
guard $ i == a
sss <- w ^? hud . hudElement . diSections
let idp = invDisplayParams w
let f x = selSecDrawCursorAt 15 idp BackdropCursor sss (i, x)
return . color (withAlpha 0.2 white) . foldMap f $ [min j b .. max j b]
-- fromMaybe mempty $ do
-- ((i, j), (a, b)) <- getMouseInvSel w
-- guard $ i == a
-- sss <- w ^? hud . hudElement . diSections
-- let idp = invDisplayParams w
-- let f x = selSecDrawCursorAt 15 idp BackdropCursor sss (i, x)
-- return . color (withAlpha 0.2 white) . foldMap f $ [min j b .. max j b]
drawSubInventory :: SubInventory -> Configuration -> World -> Picture
drawSubInventory subinv cfig w = case subinv of