This commit is contained in:
2026-05-17 23:52:17 +01:00
parent 8010335ffe
commit 75734d06af
3 changed files with 40 additions and 68 deletions
+2 -30
View File
@@ -25,9 +25,6 @@ import Data.Foldable
import qualified Data.IntMap.Strict as IM import qualified Data.IntMap.Strict as IM
import Data.Maybe import Data.Maybe
import Dodge.Data.CardinalPoint import Dodge.Data.CardinalPoint
import Dodge.Data.Config
import Dodge.Data.HUD
import Dodge.Data.SelectionList
import Dodge.ScreenPos import Dodge.ScreenPos
import Geometry.Data import Geometry.Data
@@ -47,7 +44,6 @@ ssScrollUsing ::
Maybe Selection Maybe Selection
ssScrollUsing g = ssScrollMinOnFail g . fmap (ssItems %~ IM.filter _siIsSelectable) ssScrollUsing g = ssScrollMinOnFail g . fmap (ssItems %~ IM.filter _siIsSelectable)
--
ssScrollMinOnFail :: ssScrollMinOnFail ::
(Int -> Int -> IMSS a -> Maybe (Int, Int, SelectionItem a)) -> (Int -> Int -> IMSS a -> Maybe (Int, Int, SelectionItem a)) ->
IMSS a -> IMSS a ->
@@ -55,27 +51,10 @@ ssScrollMinOnFail ::
Maybe Selection Maybe Selection
ssScrollMinOnFail f sss msel = fmap (\(i, j, _) -> Sel i j) $ l <|> ssLookupMin sss ssScrollMinOnFail f sss msel = fmap (\(i, j, _) -> Sel i j) $ l <|> ssLookupMin sss
where where
-- q = fold (msel ^? _Just . slSet)
l = do l = do
Sel i j <- msel Sel i j <- msel
f i j sss f i j sss
---- this version removes the selected set when scrolling outside it
--ssScrollMinOnFail' ::
-- (Int -> Int -> IMSS a -> Maybe (Int, Int, SelectionItem a)) ->
-- IMSS a ->
-- Maybe Selection ->
-- Maybe Selection
--ssScrollMinOnFail' f sss msel = fmap (\(i, j, _) -> Sel i j (q i j)) $ l <|> ssLookupMin sss
-- where
-- q i j = fromMaybe mempty $ do
-- Sel k _ xs <- msel ^? _Just
-- guard $ j `IS.member` xs && i == k
-- return xs
-- l = do
-- Sel i j _ <- msel
-- f i j sss
ssSetCursor :: ssSetCursor ::
(IMSS a -> Maybe (Int, Int, SelectionItem a)) -> (IMSS a -> Maybe (Int, Int, SelectionItem a)) ->
IMSS a -> IMSS a ->
@@ -84,13 +63,6 @@ ssSetCursor ::
ssSetCursor f sss msel = fromMaybe msel $ do ssSetCursor f sss msel = fromMaybe msel $ do
(i,j,_) <- f sss (i,j,_) <- f sss
return $ Just (Sel i j) return $ Just (Sel i j)
-- = fromMaybe msel $ do
-- (i, j, _) <- f sss
-- let newxs = fromMaybe mempty $ do
-- Sel k _ xs <- msel
-- guard $ k == i && j `IS.member` xs
-- return xs
-- return $ Just (Sel i j newxs)
ssLookupMax :: IMSS a -> Maybe (Int, Int, SelectionItem a) ssLookupMax :: IMSS a -> Maybe (Int, Int, SelectionItem a)
ssLookupMax sss = do ssLookupMax sss = do
@@ -237,7 +209,7 @@ inverseSelSecYintXPosCheckFixedWidth ::
Config -> LDParams -> Float -> Int -> IMSS a -> Maybe (XInfinity (Int, Int)) Config -> LDParams -> Float -> Int -> IMSS a -> Maybe (XInfinity (Int, Int))
inverseSelSecYintXPosCheckFixedWidth cfig ldp x yint sss = do inverseSelSecYintXPosCheckFixedWidth cfig ldp x yint sss = do
let sel = inverseSelSecYint yint sss let sel = inverseSelSecYint yint sss
(i,j) <- case sel of (i,_) <- case sel of
NonInf v -> Just v NonInf v -> Just v
NegInf -> do NegInf -> do
(i',j',_) <- ssLookupMin sss (i',j',_) <- ssLookupMin sss
@@ -247,7 +219,7 @@ inverseSelSecYintXPosCheckFixedWidth cfig ldp x yint sss = do
return (i',j') return (i',j')
let V2 x0 _ = screenPosAbs cfig (ldp ^. ldpPos) let V2 x0 _ = screenPosAbs cfig (ldp ^. ldpPos)
sindent <- sss ^? ix i . ssIndent sindent <- sss ^? ix i . ssIndent
itindent <- sss ^? ix i . ssItems . ix j . siOffX -- itindent <- sss ^? ix i . ssItems . ix j . siOffX
--let x1 = x0 + _ldpScale ldp * 10 * (fromIntegral (sindent + itindent) - 0.5) --let x1 = x0 + _ldpScale ldp * 10 * (fromIntegral (sindent + itindent) - 0.5)
let x1 = x0 + _ldpScale ldp * 10 * (fromIntegral (sindent) - 0.5) let x1 = x0 + _ldpScale ldp * 10 * (fromIntegral (sindent) - 0.5)
guard $ x - x1 < 170 && x > x1 guard $ x - x1 < 170 && x > x1
+9 -9
View File
@@ -66,16 +66,16 @@ updateUseInputInGame u = updateFunctionKeys $ case u ^. uvWorld . hud . subInven
sss <- di ^? diSections sss <- di ^? diSections
msel <- di ^? diSelection msel <- di ^? diSelection
filts <- di ^? filterprism filts <- di ^? filterprism
let (sss', msel', filts') = doRegexInput (u ^. uvWorld . input) x sss msel filts let ( msel', filts') = doRegexInput (u ^. uvWorld . input) x sss msel filts
return $ di return $ di
& diSections .~ sss'
& diSelection .~ msel' & diSelection .~ msel'
& filterlens .~ filts' & filterlens .~ filts'
docombineregexinput sss msel ci = fromMaybe ci $ do docombineregexinput sss msel ci = fromMaybe ci $ do
filts <- ci ^? ciFilter filts <- ci ^? ciFilter
let (sss', msel', filts') = doRegexInput (u ^. uvWorld . input) (-1) sss msel filts --let (sss', msel', filts') = doRegexInput (u ^. uvWorld . input) (-1) sss msel filts
let ( msel', filts') = doRegexInput (u ^. uvWorld . input) (-1) sss msel filts
return $ ci return $ ci
& ciSections .~ sss' -- & ciSections .~ sss'
& ciSelection .~ msel' & ciSelection .~ msel'
& ciFilter .~ filts' & ciFilter .~ filts'
@@ -455,19 +455,19 @@ doRegexInput ::
IMSS a -> IMSS a ->
Maybe Selection -> Maybe Selection ->
Maybe String -> Maybe String ->
(IMSS a, Maybe Selection, Maybe String) (Maybe Selection, Maybe String)
doRegexInput inp i sss msel filts doRegexInput inp i sss msel filts
| backspacetonothing || escapekey = endregex i 0 | backspacetonothing || escapekey = endregex i 0
| endkeys = endregex (i + 1) (j - 1) | endkeys = endregex (i + 1) (j - 1)
| otherwise = | otherwise =
( sss (-- sss ,
, msel msel
, filts & doTextInputOver inp _Just , filts & doTextInputOver inp _Just
) )
where where
endregex a b = endregex a b =
( sss (-- sss ,
, msel & ssSetCursor (ssLookupDown a b) sss msel & ssSetCursor (ssLookupDown a b) sss
, Nothing , Nothing
) )
j = fromMaybe 0 $ do j = fromMaybe 0 $ do
+29 -29
View File
@@ -3975,11 +3975,11 @@ invSetSelectionPos src/Dodge/Inventory.hs 266;" f
invShiftPointBy src/Dodge/ShiftPoint.hs 17;" f invShiftPointBy src/Dodge/ShiftPoint.hs 17;" f
invSize src/Dodge/Inventory/CheckSlots.hs 33;" f invSize src/Dodge/Inventory/CheckSlots.hs 33;" f
inventoryX src/Dodge/Creature.hs 103;" f inventoryX src/Dodge/Creature.hs 103;" f
inverseSelNumPos src/Dodge/SelectionSections.hs 264;" f inverseSelNumPos src/Dodge/SelectionSections.hs 243;" f
inverseSelNumPosFixedWidth src/Dodge/SelectionSections.hs 268;" f inverseSelNumPosFixedWidth src/Dodge/SelectionSections.hs 247;" f
inverseSelSecYint src/Dodge/SelectionSections.hs 204;" f inverseSelSecYint src/Dodge/SelectionSections.hs 183;" f
inverseSelSecYintXPosCheck src/Dodge/SelectionSections.hs 217;" f inverseSelSecYintXPosCheck src/Dodge/SelectionSections.hs 196;" f
inverseSelSecYintXPosCheckFixedWidth src/Dodge/SelectionSections.hs 236;" f inverseSelSecYintXPosCheckFixedWidth src/Dodge/SelectionSections.hs 215;" f
inverseShockwaveAt src/Dodge/WorldEvent/Shockwave.hs 44;" f inverseShockwaveAt src/Dodge/WorldEvent/Shockwave.hs 44;" f
invertEncircleDistP src/Dodge/Creature/Boid.hs 16;" f invertEncircleDistP src/Dodge/Creature/Boid.hs 16;" f
invertIntMap src/IntMapHelp.hs 100;" f invertIntMap src/IntMapHelp.hs 100;" f
@@ -4381,7 +4381,7 @@ mouseClickOptionsList src/Dodge/Update/Input/ScreenLayer.hs 70;" f
mouseCursorType src/Dodge/Render/Picture.hs 94;" f mouseCursorType src/Dodge/Render/Picture.hs 94;" f
mouseInvHeight src/Dodge/Update/Input/InGame.hs 204;" f mouseInvHeight src/Dodge/Update/Input/InGame.hs 204;" f
mouseInvPos src/Dodge/Update/Input/InGame.hs 212;" f mouseInvPos src/Dodge/Update/Input/InGame.hs 212;" f
mouseInvPosFixWidth src/Dodge/SelectionSections.hs 256;" f mouseInvPosFixWidth src/Dodge/SelectionSections.hs 235;" f
mouseWorldPos src/Dodge/Base/Coordinate.hs 39;" f mouseWorldPos src/Dodge/Base/Coordinate.hs 39;" f
mouseWorldPosW src/Dodge/Base/Coordinate.hs 42;" f mouseWorldPosW src/Dodge/Base/Coordinate.hs 42;" f
moveBullet src/Dodge/Bullet.hs 200;" f moveBullet src/Dodge/Bullet.hs 200;" f
@@ -4440,7 +4440,7 @@ newSounds src/Dodge/Creature/Perception.hs 175;" f
newSoundsToPlay src/Dodge/SoundSelection.hs 8;" f newSoundsToPlay src/Dodge/SoundSelection.hs 8;" f
newTextureFramebuffer src/Framebuffer/Setup.hs 16;" f newTextureFramebuffer src/Framebuffer/Setup.hs 16;" f
nextArc src/Dodge/Tesla.hs 61;" f nextArc src/Dodge/Tesla.hs 61;" f
nextInSectionSS src/Dodge/SelectionSections.hs 40;" f nextInSectionSS src/Dodge/SelectionSections.hs 37;" f
nextLayoutInt src/Dodge/Data/MetaTree.hs 44;" f nextLayoutInt src/Dodge/Data/MetaTree.hs 44;" f
noPic src/ShapePicture.hs 25;" f noPic src/ShapePicture.hs 25;" f
noShape src/ShapePicture.hs 29;" f noShape src/ShapePicture.hs 29;" f
@@ -4658,7 +4658,7 @@ pop3S src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 838;" f
popS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 590;" f popS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 590;" f
popScreen src/Dodge/Menu/PushPop.hs 6;" f popScreen src/Dodge/Menu/PushPop.hs 6;" f
posRms src/Dodge/Tree/Shift.hs 46;" f posRms src/Dodge/Tree/Shift.hs 46;" f
posSelSecYint src/Dodge/SelectionSections.hs 186;" f posSelSecYint src/Dodge/SelectionSections.hs 165;" f
positionRoomsFromTree src/Dodge/Tree/Shift.hs 36;" f positionRoomsFromTree src/Dodge/Tree/Shift.hs 36;" f
postGenerationProcessing src/Dodge/LevelGen.hs 31;" f postGenerationProcessing src/Dodge/LevelGen.hs 31;" f
postUniverseLoadSideEffect src/Dodge/WorldLoad.hs 14;" f postUniverseLoadSideEffect src/Dodge/WorldLoad.hs 14;" f
@@ -4979,7 +4979,7 @@ screenToWorldPos src/Dodge/Base/Coordinate.hs 45;" f
scrollAugInvSel src/Dodge/Inventory.hs 269;" f scrollAugInvSel src/Dodge/Inventory.hs 269;" f
scrollAugNextInSection src/Dodge/Inventory.hs 284;" f scrollAugNextInSection src/Dodge/Inventory.hs 284;" f
scrollRBOption src/Dodge/Update/Scroll.hs 140;" f scrollRBOption src/Dodge/Update/Scroll.hs 140;" f
scrollSelectionSections src/Dodge/SelectionSections.hs 34;" f scrollSelectionSections src/Dodge/SelectionSections.hs 31;" f
scrollTimeBack src/Dodge/Update.hs 244;" f scrollTimeBack src/Dodge/Update.hs 244;" f
scrollTimeForward src/Dodge/Update.hs 261;" f scrollTimeForward src/Dodge/Update.hs 261;" f
seagullBarkS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 624;" f seagullBarkS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 624;" f
@@ -5004,8 +5004,8 @@ selNumPosCardinal src/Dodge/Render/HUD.hs 496;" f
selSecDrawCursor src/Dodge/Render/List.hs 102;" f selSecDrawCursor src/Dodge/Render/List.hs 102;" f
selSecDrawCursor' src/Dodge/Render/List.hs 120;" f selSecDrawCursor' src/Dodge/Render/List.hs 120;" f
selSecSelCol src/Dodge/Render/HUD.hs 516;" f selSecSelCol src/Dodge/Render/HUD.hs 516;" f
selSecSelSize src/Dodge/SelectionSections.hs 182;" f selSecSelSize src/Dodge/SelectionSections.hs 161;" f
selSecYint src/Dodge/SelectionSections.hs 191;" f selSecYint src/Dodge/SelectionSections.hs 170;" f
selectedItemScroll src/Dodge/Update/Scroll.hs 50;" f selectedItemScroll src/Dodge/Update/Scroll.hs 50;" f
selectionSet src/Dodge/Update/Input/InGame.hs 149;" f selectionSet src/Dodge/Update/Input/InGame.hs 149;" f
semitoneLoop1S src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 846;" f semitoneLoop1S src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 846;" f
@@ -5257,25 +5257,25 @@ square src/Geometry/Polygon.hs 56;" f
squareDecoration src/Dodge/Placement/TopDecoration.hs 48;" f squareDecoration src/Dodge/Placement/TopDecoration.hs 48;" f
squashIntersectCirclePoint src/Dodge/WallCreatureCollisions.hs 127;" f squashIntersectCirclePoint src/Dodge/WallCreatureCollisions.hs 127;" f
squashNormalizeV src/Geometry/Vector.hs 166;" f squashNormalizeV src/Geometry/Vector.hs 166;" f
ssLookupDown src/Dodge/SelectionSections.hs 105;" f ssLookupDown src/Dodge/SelectionSections.hs 84;" f
ssLookupGE src/Dodge/SelectionSections.hs 159;" f ssLookupGE src/Dodge/SelectionSections.hs 138;" f
ssLookupGE' src/Dodge/SelectionSections.hs 175;" f ssLookupGE' src/Dodge/SelectionSections.hs 154;" f
ssLookupGT src/Dodge/SelectionSections.hs 146;" f ssLookupGT src/Dodge/SelectionSections.hs 125;" f
ssLookupGT' src/Dodge/SelectionSections.hs 152;" f ssLookupGT' src/Dodge/SelectionSections.hs 131;" f
ssLookupLE src/Dodge/SelectionSections.hs 167;" f ssLookupLE src/Dodge/SelectionSections.hs 146;" f
ssLookupLE' src/Dodge/SelectionSections.hs 134;" f ssLookupLE' src/Dodge/SelectionSections.hs 113;" f
ssLookupLT src/Dodge/SelectionSections.hs 121;" f ssLookupLT src/Dodge/SelectionSections.hs 100;" f
ssLookupLT' src/Dodge/SelectionSections.hs 127;" f ssLookupLT' src/Dodge/SelectionSections.hs 106;" f
ssLookupMax src/Dodge/SelectionSections.hs 95;" f ssLookupMax src/Dodge/SelectionSections.hs 74;" f
ssLookupMaxInSection src/Dodge/SelectionSections.hs 115;" f ssLookupMaxInSection src/Dodge/SelectionSections.hs 94;" f
ssLookupMin src/Dodge/SelectionSections.hs 141;" f ssLookupMin src/Dodge/SelectionSections.hs 120;" f
ssLookupNextMax src/Dodge/SelectionSections.hs 110;" f ssLookupNextMax src/Dodge/SelectionSections.hs 89;" f
ssLookupUp src/Dodge/SelectionSections.hs 100;" f ssLookupUp src/Dodge/SelectionSections.hs 79;" f
ssScrollMinOnFail src/Dodge/SelectionSections.hs 51;" f ssScrollMinOnFail src/Dodge/SelectionSections.hs 47;" f
ssScrollUsing src/Dodge/SelectionSections.hs 43;" f ssScrollUsing src/Dodge/SelectionSections.hs 40;" f
ssSetCursor src/Dodge/SelectionSections.hs 79;" f ssSetCursor src/Dodge/SelectionSections.hs 58;" f
ssfold src/FoldableHelp.hs 105;" f ssfold src/FoldableHelp.hs 105;" f
sssSelectionSlice src/Dodge/SelectionSections.hs 272;" f sssSelectionSlice src/Dodge/SelectionSections.hs 251;" f
stackPicturesAt src/Dodge/Render/List.hs 96;" f stackPicturesAt src/Dodge/Render/List.hs 96;" f
stackPicturesAtOff src/Dodge/Render/List.hs 99;" f stackPicturesAtOff src/Dodge/Render/List.hs 99;" f
stackText src/Picture/Base.hs 180;" f stackText src/Picture/Base.hs 180;" f