Decouple selection section inventory position

This commit is contained in:
2024-10-24 14:55:51 +01:00
parent 81f4f38166
commit 388064895f
17 changed files with 304 additions and 261 deletions
+9 -6
View File
@@ -47,7 +47,7 @@ updateCombineSections w cfig sss =
availablelines
[(0, showncombs), (-1, filtinv)]
where
mselpos = sss ^. sssExtra . sssSelPos
mselpos = w ^? hud . hudElement . subInventory . ciSelection . _Just
availablelines = getAvailableListLines secondColumnParams cfig
allcombs = IM.fromDistinctAscList $ zip [0 ..] $ combineList w
filtcombs = fromMaybe allcombs $ do
@@ -89,7 +89,11 @@ updateInventoryPositioning u =
u & uvWorld . hud . hudElement . diSections
%~ updateDisplaySections (_uvWorld u) (_uvConfig u)
updateDisplaySections :: World -> Configuration -> SelectionSections () -> SelectionSections ()
updateDisplaySections
:: World
-> Configuration
-> SelectionSections ()
-> SelectionSections ()
updateDisplaySections w cfig sss =
sss & sssSections
%~ updateSectionsPositioning
@@ -97,7 +101,7 @@ updateDisplaySections w cfig sss =
availablelines
addorder
where
mselpos = sss ^. sssExtra . sssSelPos
mselpos = w ^? hud . hudElement . diSelection . _Just
addorder = case mselpos of
Just (-1, _) -> reverse [filtinv, filtclose, invx, youx, closex]
Just (0, _) -> reverse [filtinv, filtclose, invx, youx, closex]
@@ -237,7 +241,7 @@ listSelectionColorPicture = foldMap f
g str = (_siColor si,translate indent 0 . color (_siColor si) $ text str)
enterCombineInv :: Configuration -> World -> World
enterCombineInv cfig w = w & hud . hudElement . subInventory .~ CombineInventory sss
enterCombineInv cfig w = w & hud . hudElement . subInventory .~ CombineInventory sss selpos
where
cm' = IM.fromDistinctAscList . zip [0 ..] $ combineList w
cm
@@ -248,8 +252,7 @@ enterCombineInv cfig w = w & hud . hudElement . subInventory .~ CombineInventory
{ _sssSections = IM.fromDistinctAscList [(-1, filtsection), (0, combsection)]
, _sssExtra =
SSSExtra
{ _sssSelPos = selpos
, _sssFilters = IM.singleton (-1) Nothing
{ _sssFilters = IM.singleton (-1) Nothing
}
}
selpos