Allow dropping items by dragging off inventory

This commit is contained in:
2024-11-19 22:24:03 +00:00
parent 13339c9a12
commit 2dc5d35744
11 changed files with 145 additions and 123 deletions
+1 -4
View File
@@ -66,10 +66,6 @@ drawInventory sss w cfig =
<> drawRootCursor w sss (w ^? hud . hudElement . diSelection . _Just) ldp cfig
<> iextra
<> drawMouseOver cfig w
-- <> translateScreenPos
-- cfig
-- (ldp ^. ldpPos)
-- (drawDISelections w)
where
ldp = invDisplayParams w
curs = invCursorParams w
@@ -110,6 +106,7 @@ getRootItemBounds i inv = do
y <- locLeftmost root ^? locLDT . ldtValue . cItem . itLocation . ilInvID
return (x, y)
-- this should display while dragging a single inv item
drawMouseOver :: Configuration -> World -> Picture
drawMouseOver cfig w = concat (invsel <|> combinvsel
<|> drawDragSelect cfig w)
+1 -1
View File
@@ -111,7 +111,7 @@ selSecDrawCursorAt ::
IM.IntMap (SelectionSection a) ->
(Int, Int) ->
Picture
selSecDrawCursorAt xsize ldp curs sss (i, j) = fromMaybe mempty $ do
selSecDrawCursorAt xsize ldp curs sss (i, j) = fold $ do
yint <- selSecYint i j sss
xint <- sss ^? ix i . ssIndent
si <- sss ^? ix i . ssItems . ix j
+9 -2
View File
@@ -84,7 +84,8 @@ mouseCursorType u = case u ^. uvWorld . input . mouseContext of
MouseMenuClick {} -> drawMenuClick 5
MouseMenuCursor -> drawMenuCursor 5
MouseInGame -> drawPlus 5
OverInvDrag -> drawDrag 5
OverInvDrag (Just _) -> drawDrag 5
OverInvDrag Nothing -> drawDragDrop 5
OverInvDragSelect {} -> drawDragSelect 5
OverInvSelect {} -> drawSelect 5
OverInvFilt {} -> drawCombFilter 5
@@ -157,6 +158,12 @@ drawDragSelect x = polygonWire $ rectWH (0.5 * x) x
drawDrag :: Float -> Picture
drawDrag x = line [V2 0 x,V2 0 (-x)]
drawDragDrop :: Float -> Picture
drawDragDrop x = line [V2 (-x) x,V2 0 x,V2 0 (-x)]
<> line [V2 (-y) (y-x), V2 0 (-x), V2 y (y-x)]
where
y = 0.7 * x
drawSelect :: Float -> Picture
drawSelect x = polygonWire $ rectWH x (0.5 * x)
-- line [V2 (-x) 0, V2 0 0]
@@ -188,7 +195,7 @@ drawGapPlus x =
]
aimDelaySweep :: World -> Picture
aimDelaySweep w = fromMaybe mempty $ do
aimDelaySweep w = fold $ do
cr <- w ^? cWorld . lWorld . creatures . ix 0
aimstatus <- cr ^? crStance . posture
guard (aimstatus == Aiming)