Change behaviour when clicking on filter

This commit is contained in:
2024-11-26 11:59:26 +00:00
parent 145ab77859
commit a4d95c5bd5
6 changed files with 35 additions and 11 deletions
+22 -3
View File
@@ -40,7 +40,7 @@ updateUseInputInGame u = updateFunctionKeys $ case u ^. uvWorld . hud . hudEleme
DisplayCarte -> over uvWorld updatePressedButtonsCarte u
DisplayInventory{_subInventory = si, _diSelection = disel} -> case si of
DisplayTerminal tmid -> updateKeysInTerminal tmid u
CombineInventory{_ciSections = sss, _ciSelection = msel@(Just ((-1),_,_))} ->
CombineInventory{_ciSections = sss, _ciSelection = msel@(Just (-1,_,_))} ->
u
& uvWorld . hud . hudElement . subInventory
%~ docombineregexinput sss msel
@@ -171,6 +171,12 @@ updateMouseClickInGame cfig w = case w ^. input . mouseContext of
return $
w & input . mouseContext
.~ OverInvDragSelect ysel Nothing
OverInvSelect (-1,_) | selsec == Just (-1) -> w
& hud . hudElement . diSelection %~ endRegex (-1) w
& hud . hudElement . diInvFilter .~ Nothing
OverInvSelect (2,_) | selsec == Just 2 -> w
& hud . hudElement . diSelection %~ endRegex 2 w
& hud . hudElement . diCloseFilter .~ Nothing
OverInvSelect x | ScancodeLShift `M.member` (w ^. input . pressedKeys )
-> fromMaybe w $ do
guard (isGroupSelectableSection $ fst x)
@@ -195,7 +201,7 @@ updateMouseClickInGame cfig w = case w ^. input . mouseContext of
w
& worldEventFlags . at InventoryChange ?~ ()
& hud . hudElement . subInventory .~ NoSubInventory
OverInvFilt (i, j) -> fromMaybe w $ do
OverCombFiltInv (i, j) -> fromMaybe w $ do
guard $ i == 0
str <-
fmap (take 5) $
@@ -213,6 +219,18 @@ updateMouseClickInGame cfig w = case w ^. input . mouseContext of
ldp = invDisplayParams w
mpos = w ^. input . mousePos
f (x,y) = (x,y,mempty)
selsec = w ^? hud . hudElement . diSelection . _Just . _1
endRegex :: Int -> World
-> Maybe (Int,Int,IS.IntSet)
-> Maybe (Int,Int,IS.IntSet)
endRegex i w = fromMaybe id $ do
sss <- w ^? hud . hudElement . diSections
let j = fromMaybe 0 $ do
itms <- sss ^? ix i . ssItems
(k,_) <- IM.lookupMin itms
return k
return $ ssSetCursor (ssLookupDown i j) sss
startDrag :: (Int, Int) -> Configuration -> World -> World
startDrag (a, b) cfig w = setcontext
@@ -394,7 +412,8 @@ doRegexInput inp i sss msel filts
)
where
endregex a b =
( sss & ix i . ssItems .~ mempty
--( sss & ix i . ssItems .~ mempty
( sss -- & ix i . ssItems .~ mempty
, msel & ssSetCursor (ssLookupDown a b) sss
, Nothing
)