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
+5 -2
View File
@@ -354,14 +354,13 @@ checkTermDist w = fromMaybe w $ do
updateMouseContext :: Configuration -> Universe -> Universe
updateMouseContext cfig u = case u ^. uvWorld . input . mouseContext of
OverInvDrag | lbheld -> u
OverInvDrag {} -> u & uvWorld . input . mouseContext .~ invdrag
OverInvDragSelect{} -> u
_ -> u & uvWorld . input . mouseContext
.~ fromMaybe
aimcontext
(overmenu <|> overinv <|> overcomb <|> overterm)
where
lbheld = ButtonLeft `M.member` (u ^. uvWorld . input . mouseButtons)
overmenu = do
screen <- u ^? uvScreenLayers . ix 0
return $ case screen ^. scOptions of
@@ -384,6 +383,10 @@ updateMouseContext cfig u = case u ^. uvWorld . input . mouseContext of
| ButtonRight `M.member` (w ^. input . mouseButtons) = MouseAiming
| otherwise = MouseInGame
mpos = w ^. input . mousePos
invdrag = fromMaybe (OverInvDrag Nothing) $ do
sss <- w ^? hud . hudElement . diSections
(0,j) <- inverseSelNumPos cfig (invDisplayParams w) sss mpos
return $ OverInvDrag $ Just j
overinv = do
sss <- w ^? hud . hudElement . diSections
selpos <- inverseSelNumPos cfig (invDisplayParams w) sss mpos