Inventory: allow selection and dropping by dragging while filtering
This commit is contained in:
@@ -3,6 +3,7 @@ module Dodge.Update.Input.InGame (
|
||||
updateMouseInGame,
|
||||
) where
|
||||
|
||||
import Data.Foldable
|
||||
import Control.Applicative
|
||||
import Control.Monad
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
@@ -127,9 +128,15 @@ updateMouseReleaseInGame w = case w ^. input . mouseContext of
|
||||
OverInvDragSelect ssel (Just esel) ->
|
||||
w & input . mouseContext .~ MouseInGame
|
||||
& hud . hudElement . diSelectionExtra
|
||||
.~ IS.fromAscList [min (snd ssel) (snd esel) + 1 .. max (snd ssel) (snd esel)]
|
||||
.~ h (snd ssel) (snd esel)-- IM.keysSet [min (snd ssel) (snd esel) + 1 .. max (snd ssel) (snd esel)]
|
||||
& augInvDirectSelect (min ssel esel)
|
||||
_ -> w
|
||||
where
|
||||
h i j = fold $ do
|
||||
sss <- w ^? hud . hudElement . diSections . ix 0 . ssItems
|
||||
let (_,xss) = IM.split ((min i j)-1) sss
|
||||
(yss,_) = IM.split ((max i j)+1) xss
|
||||
return . IM.keysSet $ yss
|
||||
|
||||
updateMouseClickInGame :: Configuration -> World -> World
|
||||
updateMouseClickInGame cfig w = case w ^. input . mouseContext of
|
||||
@@ -483,7 +490,7 @@ tryCombine ::
|
||||
World
|
||||
tryCombine (i, j) w = fromMaybe w $ do
|
||||
sss <- w ^? hud . hudElement . subInventory . ciSections
|
||||
CombinableItem is it _ <- sss ^? ix i . ssItems . ix j . siPayload
|
||||
CombinableItem is it <- sss ^? ix i . ssItems . ix j . siPayload
|
||||
p <- w ^? cWorld . lWorld . creatures . ix 0 . crPos
|
||||
return $
|
||||
snd (createItemYou it (foldr (destroyInvItem 0) w (sort is)))
|
||||
|
||||
Reference in New Issue
Block a user