diff --git a/src/Dodge/SelectionSections.hs b/src/Dodge/SelectionSections.hs index da12e6eb1..18d891be9 100644 --- a/src/Dodge/SelectionSections.hs +++ b/src/Dodge/SelectionSections.hs @@ -25,9 +25,6 @@ import Data.Foldable import qualified Data.IntMap.Strict as IM import Data.Maybe import Dodge.Data.CardinalPoint -import Dodge.Data.Config -import Dodge.Data.HUD -import Dodge.Data.SelectionList import Dodge.ScreenPos import Geometry.Data @@ -47,7 +44,6 @@ ssScrollUsing :: Maybe Selection ssScrollUsing g = ssScrollMinOnFail g . fmap (ssItems %~ IM.filter _siIsSelectable) --- ssScrollMinOnFail :: (Int -> Int -> IMSS a -> Maybe (Int, Int, SelectionItem a)) -> IMSS a -> @@ -55,27 +51,10 @@ ssScrollMinOnFail :: Maybe Selection ssScrollMinOnFail f sss msel = fmap (\(i, j, _) -> Sel i j) $ l <|> ssLookupMin sss where --- q = fold (msel ^? _Just . slSet) l = do Sel i j <- msel 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 :: (IMSS a -> Maybe (Int, Int, SelectionItem a)) -> IMSS a -> @@ -84,13 +63,6 @@ ssSetCursor :: ssSetCursor f sss msel = fromMaybe msel $ do (i,j,_) <- f sss 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 sss = do @@ -237,7 +209,7 @@ inverseSelSecYintXPosCheckFixedWidth :: Config -> LDParams -> Float -> Int -> IMSS a -> Maybe (XInfinity (Int, Int)) inverseSelSecYintXPosCheckFixedWidth cfig ldp x yint sss = do let sel = inverseSelSecYint yint sss - (i,j) <- case sel of + (i,_) <- case sel of NonInf v -> Just v NegInf -> do (i',j',_) <- ssLookupMin sss @@ -247,7 +219,7 @@ inverseSelSecYintXPosCheckFixedWidth cfig ldp x yint sss = do return (i',j') let V2 x0 _ = screenPosAbs cfig (ldp ^. ldpPos) 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) - 0.5) guard $ x - x1 < 170 && x > x1 diff --git a/src/Dodge/Update/Input/InGame.hs b/src/Dodge/Update/Input/InGame.hs index c1ecfb2e7..59d8e25aa 100644 --- a/src/Dodge/Update/Input/InGame.hs +++ b/src/Dodge/Update/Input/InGame.hs @@ -66,16 +66,16 @@ updateUseInputInGame u = updateFunctionKeys $ case u ^. uvWorld . hud . subInven sss <- di ^? diSections msel <- di ^? diSelection 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 - & diSections .~ sss' & diSelection .~ msel' & filterlens .~ filts' docombineregexinput sss msel ci = fromMaybe ci $ do 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 - & ciSections .~ sss' +-- & ciSections .~ sss' & ciSelection .~ msel' & ciFilter .~ filts' @@ -455,19 +455,19 @@ doRegexInput :: IMSS a -> Maybe Selection -> Maybe String -> - (IMSS a, Maybe Selection, Maybe String) + (Maybe Selection, Maybe String) doRegexInput inp i sss msel filts | backspacetonothing || escapekey = endregex i 0 | endkeys = endregex (i + 1) (j - 1) | otherwise = - ( sss - , msel + (-- sss , + msel , filts & doTextInputOver inp _Just ) where endregex a b = - ( sss - , msel & ssSetCursor (ssLookupDown a b) sss + (-- sss , + msel & ssSetCursor (ssLookupDown a b) sss , Nothing ) j = fromMaybe 0 $ do diff --git a/tags b/tags index 21131b64e..7dee51a26 100644 --- a/tags +++ b/tags @@ -3975,11 +3975,11 @@ invSetSelectionPos src/Dodge/Inventory.hs 266;" f invShiftPointBy src/Dodge/ShiftPoint.hs 17;" f invSize src/Dodge/Inventory/CheckSlots.hs 33;" f inventoryX src/Dodge/Creature.hs 103;" f -inverseSelNumPos src/Dodge/SelectionSections.hs 264;" f -inverseSelNumPosFixedWidth src/Dodge/SelectionSections.hs 268;" f -inverseSelSecYint src/Dodge/SelectionSections.hs 204;" f -inverseSelSecYintXPosCheck src/Dodge/SelectionSections.hs 217;" f -inverseSelSecYintXPosCheckFixedWidth src/Dodge/SelectionSections.hs 236;" f +inverseSelNumPos src/Dodge/SelectionSections.hs 243;" f +inverseSelNumPosFixedWidth src/Dodge/SelectionSections.hs 247;" f +inverseSelSecYint src/Dodge/SelectionSections.hs 183;" f +inverseSelSecYintXPosCheck src/Dodge/SelectionSections.hs 196;" f +inverseSelSecYintXPosCheckFixedWidth src/Dodge/SelectionSections.hs 215;" f inverseShockwaveAt src/Dodge/WorldEvent/Shockwave.hs 44;" f invertEncircleDistP src/Dodge/Creature/Boid.hs 16;" 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 mouseInvHeight src/Dodge/Update/Input/InGame.hs 204;" 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 mouseWorldPosW src/Dodge/Base/Coordinate.hs 42;" 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 newTextureFramebuffer src/Framebuffer/Setup.hs 16;" 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 noPic src/ShapePicture.hs 25;" 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 popScreen src/Dodge/Menu/PushPop.hs 6;" 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 postGenerationProcessing src/Dodge/LevelGen.hs 31;" 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 scrollAugNextInSection src/Dodge/Inventory.hs 284;" 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 scrollTimeForward src/Dodge/Update.hs 261;" 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 120;" f selSecSelCol src/Dodge/Render/HUD.hs 516;" f -selSecSelSize src/Dodge/SelectionSections.hs 182;" f -selSecYint src/Dodge/SelectionSections.hs 191;" f +selSecSelSize src/Dodge/SelectionSections.hs 161;" f +selSecYint src/Dodge/SelectionSections.hs 170;" f selectedItemScroll src/Dodge/Update/Scroll.hs 50;" f selectionSet src/Dodge/Update/Input/InGame.hs 149;" 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 squashIntersectCirclePoint src/Dodge/WallCreatureCollisions.hs 127;" f squashNormalizeV src/Geometry/Vector.hs 166;" f -ssLookupDown src/Dodge/SelectionSections.hs 105;" f -ssLookupGE src/Dodge/SelectionSections.hs 159;" f -ssLookupGE' src/Dodge/SelectionSections.hs 175;" f -ssLookupGT src/Dodge/SelectionSections.hs 146;" f -ssLookupGT' src/Dodge/SelectionSections.hs 152;" f -ssLookupLE src/Dodge/SelectionSections.hs 167;" f -ssLookupLE' src/Dodge/SelectionSections.hs 134;" f -ssLookupLT src/Dodge/SelectionSections.hs 121;" f -ssLookupLT' src/Dodge/SelectionSections.hs 127;" f -ssLookupMax src/Dodge/SelectionSections.hs 95;" f -ssLookupMaxInSection src/Dodge/SelectionSections.hs 115;" f -ssLookupMin src/Dodge/SelectionSections.hs 141;" f -ssLookupNextMax src/Dodge/SelectionSections.hs 110;" f -ssLookupUp src/Dodge/SelectionSections.hs 100;" f -ssScrollMinOnFail src/Dodge/SelectionSections.hs 51;" f -ssScrollUsing src/Dodge/SelectionSections.hs 43;" f -ssSetCursor src/Dodge/SelectionSections.hs 79;" f +ssLookupDown src/Dodge/SelectionSections.hs 84;" f +ssLookupGE src/Dodge/SelectionSections.hs 138;" f +ssLookupGE' src/Dodge/SelectionSections.hs 154;" f +ssLookupGT src/Dodge/SelectionSections.hs 125;" f +ssLookupGT' src/Dodge/SelectionSections.hs 131;" f +ssLookupLE src/Dodge/SelectionSections.hs 146;" f +ssLookupLE' src/Dodge/SelectionSections.hs 113;" f +ssLookupLT src/Dodge/SelectionSections.hs 100;" f +ssLookupLT' src/Dodge/SelectionSections.hs 106;" f +ssLookupMax src/Dodge/SelectionSections.hs 74;" f +ssLookupMaxInSection src/Dodge/SelectionSections.hs 94;" f +ssLookupMin src/Dodge/SelectionSections.hs 120;" f +ssLookupNextMax src/Dodge/SelectionSections.hs 89;" f +ssLookupUp src/Dodge/SelectionSections.hs 79;" f +ssScrollMinOnFail src/Dodge/SelectionSections.hs 47;" f +ssScrollUsing src/Dodge/SelectionSections.hs 40;" f +ssSetCursor src/Dodge/SelectionSections.hs 58;" 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 stackPicturesAtOff src/Dodge/Render/List.hs 99;" f stackText src/Picture/Base.hs 180;" f