Incomplete work on mouse interaction with filtered inventory

This commit is contained in:
2024-11-20 08:45:51 +00:00
parent 2dc5d35744
commit 3ecf137801
7 changed files with 196 additions and 197 deletions
+6 -48
View File
@@ -304,56 +304,10 @@ checkTermDist w = fromMaybe w $ do
w & hud . hudElement . subInventory
.~ NoSubInventory --MouseInvNothing
---- for other mouse effects, see yourControl
--updateMouseInventoryEffects :: Configuration -> World -> World
--updateMouseInventoryEffects cfig w = w
--updateMouseInventorySelection :: Configuration -> World -> World
--updateMouseInventorySelection cfig w = fromMaybe w $ do
-- sss <- w ^? hud . hudElement . diSections
-- return $ updateMouseInventorySelection' sss cfig w
--updateMouseInventorySelection' ::
-- IM.IntMap (SelectionSection a) ->
-- Configuration ->
-- World ->
-- World
--updateMouseInventorySelection' sss cfig w
-- | leftclickstart = w
---- case msel of
---- Nothing -> fromMaybe w $ do
---- ysel <- inverseSelSecYint (posSelSecYint cfig ldp (mpos ^. _y)) sss
---- return $
---- w & input . mouseContext
---- .~ OverInvDragSelect ysel Nothing
---- Just p -> w --startDrag p w
-- | leftclickheld = case w ^? input . mouseContext of
---- Just OverInvDragSelect{} ->
---- w & input . mouseContext . mcoSelEnd .~ msel
---- Just OverInvDrag -> fromMaybe w $ do
---- sel <- w ^? hud . hudElement . diSelection . _Just
---- x <- w ^? hud . hudElement . diSelectionExtra
---- return $ w & shiftInvItems sel x cfig mpos ldp sss
-- _ -> w
-- | otherwise = w
---- | otherwise = case w ^? input . mouseContext of
---- Just (OverInvDragSelect ssel (Just esel)) ->
---- w & input . mouseContext .~ MouseInGame
---- & hud . hudElement . diSelectionExtra
---- .~ (max (snd ssel) (snd esel) - min (snd ssel) (snd esel))
---- & augInvDirectSelect (min ssel esel)
---- _ -> w-- & hud . hudElement . subInventory . nsSelected .~ MouseInvNothing
-- where
-- leftclickstart = w ^? input . mouseButtons . ix ButtonLeft == Just 0 && nobuttonright
-- leftclickheld = ButtonLeft `M.member` (w ^. input . mouseButtons) && nobuttonright
-- nobuttonright = not $ ButtonRight `M.member` (w ^. input . mouseButtons)
-- mpos = w ^. input . mousePos
-- ldp = invDisplayParams w
-- msel = inverseSelNumPos cfig ldp sss (w ^. input . mousePos)
updateMouseContext :: Configuration -> Universe -> Universe
updateMouseContext cfig u = case u ^. uvWorld . input . mouseContext of
OverInvFiltDrag -> u & uvWorld . input . mouseContext .~ invfiltdrag
OverInvFiltDragDrop -> u & uvWorld . input . mouseContext .~ invfiltdrag
OverInvDrag {} -> u & uvWorld . input . mouseContext .~ invdrag
OverInvDragSelect{} -> u
_ -> u & uvWorld . input . mouseContext
@@ -387,6 +341,10 @@ updateMouseContext cfig u = case u ^. uvWorld . input . mouseContext of
sss <- w ^? hud . hudElement . diSections
(0,j) <- inverseSelNumPos cfig (invDisplayParams w) sss mpos
return $ OverInvDrag $ Just j
invfiltdrag = fromMaybe OverInvFiltDragDrop $ do
sss <- w ^? hud . hudElement . diSections
(0,_) <- inverseSelNumPos cfig (invDisplayParams w) sss mpos
return $ OverInvFiltDrag
overinv = do
sss <- w ^? hud . hudElement . diSections
selpos <- inverseSelNumPos cfig (invDisplayParams w) sss mpos