Change selection set to work for multiple sections
This commit is contained in:
+15
-10
@@ -95,11 +95,11 @@ rmInvItem cid invid w =
|
||||
where
|
||||
pointcid = cWorld . lWorld . creatures . ix cid
|
||||
updateselectionextra
|
||||
| cid == 0 = hud . diSelection . _Just . slSet %~ IS.foldl' h mempty
|
||||
-- | cid == 0 = hud . diSelection . _Just . slSet %~ IS.foldl' h mempty
|
||||
| otherwise = id
|
||||
h x i | i > _unNInt invid = IS.insert (i-1) x
|
||||
| i < _unNInt invid = IS.insert i x
|
||||
| otherwise = x
|
||||
-- h x i | i > _unNInt invid = IS.insert (i-1) x
|
||||
-- | i < _unNInt invid = IS.insert i x
|
||||
-- | otherwise = x
|
||||
updateselection
|
||||
| cid == 0 && cr ^? crManipulation . manObject . imSelectedItem == Just invid =
|
||||
scrollAugInvSel (-1) . scrollAugInvSel 1
|
||||
@@ -159,7 +159,9 @@ changeSwapSelSet yi w
|
||||
|
||||
swapSelSet :: (Int -> IS.IntSet -> World -> World) -> World -> World
|
||||
swapSelSet f w = fromMaybe w $ do
|
||||
Sel j i is' <- w ^. hud . diSelection
|
||||
-- Sel j i is' <- w ^. hud . diSelection
|
||||
Sel j i <- w ^. hud . diSelection
|
||||
is' <- w ^? hud . diSections . ix j . ssSet
|
||||
let is = if IS.null is'
|
||||
then IS.singleton i
|
||||
else is'
|
||||
@@ -231,7 +233,9 @@ multiSelScroll yi w
|
||||
|
||||
multiSelScroll' :: (Int -> IM.IntMap (SelectionItem ()) -> Maybe Int) -> World -> World
|
||||
multiSelScroll' f w = fromMaybe w $ do
|
||||
Sel j i is <- w ^. hud . diSelection
|
||||
--Sel j i is <- w ^. hud . diSelection
|
||||
Sel j i <- w ^. hud . diSelection
|
||||
is <- w ^? hud . diSections . ix j . ssSet
|
||||
ss <- w ^? hud . diSections . ix j . ssItems
|
||||
k <- f i ss
|
||||
let insertordelete
|
||||
@@ -240,7 +244,8 @@ multiSelScroll' f w = fromMaybe w $ do
|
||||
| otherwise = IS.insert i . IS.insert k
|
||||
return $
|
||||
w
|
||||
& hud . diSelection . _Just . slSet %~ insertordelete
|
||||
-- & hud . diSelection . _Just . slSet %~ insertordelete
|
||||
& hud . diSections . ix j . ssSet %~ insertordelete
|
||||
& hud . diSelection . _Just . slInt .~ k
|
||||
|
||||
changeSwapOther ::
|
||||
@@ -259,7 +264,7 @@ changeSwapOther manlens n f i w = fromMaybe w $ do
|
||||
| otherwise = j
|
||||
return $
|
||||
w
|
||||
& swapAnyExtraSelection i k
|
||||
& swapAnyExtraSelection 3 i k
|
||||
& cWorld
|
||||
. lWorld
|
||||
. creatures
|
||||
@@ -285,7 +290,7 @@ swapItemWith f (j, i) = case j of
|
||||
|
||||
changeSwapWith :: (Int -> IM.IntMap (SelectionItem ()) -> Maybe Int) -> World -> World
|
||||
changeSwapWith f w
|
||||
| Just (Sel j i _) <- w ^. hud . diSelection = swapItemWith f (j, i) w
|
||||
| Just (Sel j i) <- w ^. hud . diSelection = swapItemWith f (j, i) w
|
||||
| otherwise = w
|
||||
|
||||
invSetSelection :: Selection -> World -> World
|
||||
@@ -297,7 +302,7 @@ invSetSelection sel w =
|
||||
& cWorld . lWorld %~ crUpdateItemLocations 0
|
||||
|
||||
invSetSelectionPos :: Int -> Int -> World -> World
|
||||
invSetSelectionPos i j = invSetSelection (Sel i j mempty)
|
||||
invSetSelectionPos i j = invSetSelection (Sel i j)
|
||||
|
||||
scrollAugInvSel :: Int -> World -> World
|
||||
scrollAugInvSel yi w
|
||||
|
||||
Reference in New Issue
Block a user