Continue improving mouse|inventory interface

This commit is contained in:
2024-11-21 21:04:07 +00:00
parent efef41c9e1
commit 1250e2442a
9 changed files with 165 additions and 148 deletions
+3 -25
View File
@@ -131,29 +131,14 @@ drawMouseOver cfig w = concat (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
--drawDISelections :: World -> Picture
--drawDISelections w = fromMaybe mempty $
-- drawDragSelect w <|>
-- drawDragSelected w
drawDragSelected :: Configuration -> World -> Maybe Picture
drawDragSelected cfig w = do
ys <- w ^? hud . hudElement . diSelectionExtra
guard $ not (IS.null ys)
(i,j) <- w ^? hud . hudElement . diSelection . _Just
guard $ i == 0
sss <- w ^? hud . hudElement . diSections
let idp = invDisplayParams w
let f x = (selSecDrawCursorAt 15 idp BackdropCursor sss (0, x) <>)
let f x = (selSecDrawCursorAt 15 idp BackdropCursor sss (i, x) <>)
return . translateScreenPos cfig (invDisplayParams w ^. ldpPos)
. color (withAlpha 0.2 white) . IS.foldr f mempty $ IS.insert j ys
@@ -167,13 +152,6 @@ drawDragSelect cfig w = do
let f x = selSecDrawCursorAt 15 idp BackdropCursor sss (i, x)
return . translateScreenPos cfig (invDisplayParams w ^. ldpPos)
. 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
@@ -203,14 +181,14 @@ drawExamineInventory cfig w =
<> drawSelectionList
secondColumnParams
cfig
( (map f
( map f
( makeParagraph 55 $
yourAugmentedItem
itemInfo
(yourInfo (you w))
(closeObjectInfo (crNumFreeSlots (you w)))
w
))
)
)
where
f str =