Allow scrolling within a larger selection to not remove larger selection

This commit is contained in:
2024-11-25 17:20:09 +00:00
parent 83bcf3c0f7
commit 669f9667f1
16 changed files with 233 additions and 200 deletions
+2 -1
View File
@@ -59,7 +59,8 @@ tryPutItemInInv cid flit w = case maybeInvSlot of
& cWorld . lWorld %~ crUpdateItemLocations cid
)
where
updateselectionextra | cid == 0 = hud . hudElement . diSelectionExtra .~ mempty
updateselectionextra | cid == 0
= hud . hudElement . diSelection . _Just . _3 %~ const mempty
| otherwise = id
it = _flIt flit
maybeInvSlot = checkInvSlotsYou it w
+1 -1
View File
@@ -83,7 +83,7 @@ setInvPosFromSS w =
& cWorld . lWorld . creatures . ix 0 . crManipulation . manObject .~ thesel
where
thesel = fromMaybe SelNothing $ do
(i, j) <- w ^? hud . hudElement . diSelection . _Just
(i, j, _) <- w ^? hud . hudElement . diSelection . _Just
case i of
(-1) -> Just SortInventory
0 -> do
+4 -4
View File
@@ -27,8 +27,8 @@ swapInvItems f i w = fromMaybe w $ do
ss <- w ^? hud . hudElement . diSections . ix 0 . ssItems
k <- f i ss
let updateselection = case w ^? hud . hudElement . diSelection . _Just of
Just (0, j) | j == k -> hud . hudElement . diSelection . _Just . _2 .~ i
Just (0, j) | j == i -> hud . hudElement . diSelection . _Just . _2 .~ k
Just (0, j,_) | j == k -> hud . hudElement . diSelection . _Just . _2 .~ i
Just (0, j,_) | j == i -> hud . hudElement . diSelection . _Just . _2 .~ k
_ -> id
return $
w
@@ -71,11 +71,11 @@ swapInvItems f i w = fromMaybe w $ do
swapAnyExtraSelection :: Int -> Int -> World -> World
swapAnyExtraSelection i k w = fromMaybe w $ do
is <- w ^? hud . hudElement . diSelectionExtra
is <- w ^? hud . hudElement . diSelection . _Just . _3
let f = if i `IS.member` is then IS.insert k else id
g = if k `IS.member` is then IS.insert i else id
return $
w & hud . hudElement . diSelectionExtra
w & hud . hudElement . diSelection . _Just . _3
%~ (f . g . IS.delete i . IS.delete k)
checkConnection :: SoundOrigin -> SoundID -> Int -> Int -> World -> World