Allow scrolling within a larger selection to not remove larger selection
This commit is contained in:
@@ -16,6 +16,7 @@ module Dodge.Inventory (
|
||||
swapItemWith,
|
||||
) where
|
||||
|
||||
import qualified Data.IntSet as IS
|
||||
import Dodge.Inventory.Swap
|
||||
import Data.Function
|
||||
import Data.Maybe
|
||||
@@ -78,7 +79,7 @@ rmInvItem cid invid w =
|
||||
where
|
||||
pointcid = cWorld . lWorld . creatures . ix cid
|
||||
updateselectionextra
|
||||
| cid == 0 = hud . hudElement . diSelectionExtra .~ mempty
|
||||
| cid == 0 = hud . hudElement . diSelection . _Just . _3 %~ const mempty
|
||||
| otherwise = id
|
||||
updateselection
|
||||
| cid == 0 && cr ^? crManipulation . manObject . imSelectedItem == Just invid =
|
||||
@@ -183,15 +184,15 @@ swapItemWith f (j, i) w = case j of
|
||||
|
||||
changeSwapWith :: (Int -> IM.IntMap (SelectionItem ()) -> Maybe Int) -> World -> World
|
||||
changeSwapWith f w = case w ^? hud . hudElement . diSelection . _Just of
|
||||
Just (0, i) -> w & swapInvItems f i
|
||||
Just (3, i) -> w & changeSwapOther ispCloseItem 3 f i
|
||||
Just (5, i) -> w & changeSwapOther ispCloseButton 5 f i
|
||||
Just (0, i, _) -> w & swapInvItems f i
|
||||
Just (3, i, _) -> w & changeSwapOther ispCloseItem 3 f i
|
||||
Just (5, i, _) -> w & changeSwapOther ispCloseButton 5 f i
|
||||
_ -> w
|
||||
|
||||
augInvDirectSelect :: (Int, Int) -> World -> World
|
||||
augInvDirectSelect (i, j) w =
|
||||
augInvDirectSelect :: (Int, Int, IS.IntSet) -> World -> World
|
||||
augInvDirectSelect sel w =
|
||||
w
|
||||
& hud . hudElement . diSelection ?~ (i, j)
|
||||
& hud . hudElement . diSelection ?~ sel
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
& setInvPosFromSS
|
||||
& cWorld . lWorld %~ crUpdateItemLocations 0
|
||||
|
||||
Reference in New Issue
Block a user