Continue mouse refactor, add explicit release event/timer
This commit is contained in:
+17
-9
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user