Make inventory cursor change when dropping items sensible

This commit is contained in:
2024-11-01 11:23:39 +00:00
parent de12f0ef34
commit 723dfafc18
5 changed files with 117 additions and 70 deletions
+7 -1
View File
@@ -5,6 +5,7 @@ module Dodge.DisplayInventory (
updateCombinePositioning,
) where
import Dodge.Inventory
import Control.Lens
import Control.Monad
import qualified Data.IntMap.Strict as IM
@@ -79,8 +80,13 @@ updateInventoryPositioning u =
%~ updateDisplaySections (_uvWorld u) (_uvConfig u)
& checkInventorySelectionExists
-- this is possibly not completely correct
checkInventorySelectionExists :: Universe -> Universe
checkInventorySelectionExists u = u
checkInventorySelectionExists u = fromMaybe u $ do
(i,j) <- u ^? uvWorld . hud . hudElement . diSelection . _Just
Just $ case u ^? uvWorld . hud . hudElement . diSections . ix i . ssItems . ix j of
Nothing -> u & uvWorld %~ scrollAugNextInSection
_ -> u
updateDisplaySections ::
World ->