Decouple selection section inventory position
This commit is contained in:
@@ -3,7 +3,7 @@ module Dodge.SelectionSections (
|
||||
ssLookupDown,
|
||||
ssLookupGT,
|
||||
ssSetCursor,
|
||||
setFirstPosSelectionSections,
|
||||
-- setFirstPosSelectionSections,
|
||||
selSecYint,
|
||||
selSecSelSize,
|
||||
inverseSelSecYint,
|
||||
@@ -31,10 +31,10 @@ scrollSelectionSections yi sss msel
|
||||
| yi > 0 = foldr ($) msel $ replicate yi (ssScrollUsing ssLookupUp sss)
|
||||
| otherwise = foldr ($) msel $ replicate (negate yi) (ssScrollUsing ssLookupDown sss)
|
||||
|
||||
setFirstPosSelectionSections :: SelectionSections a -> SelectionSections a
|
||||
setFirstPosSelectionSections sss = fromMaybe sss $ do
|
||||
(i, j, _) <- ssLookupMin sss
|
||||
return $ sss & sssExtra . sssSelPos ?~ (i, j)
|
||||
--setFirstPosSelectionSections :: SelectionSections a -> SelectionSections a
|
||||
--setFirstPosSelectionSections sss = fromMaybe sss $ do
|
||||
-- (i, j, _) <- ssLookupMin sss
|
||||
-- return $ sss & sssExtra . sssSelPos ?~ (i, j)
|
||||
|
||||
ssScrollUsing ::
|
||||
(Int -> Int -> SelectionSections a -> Maybe (Int, Int, SelectionItem a)) ->
|
||||
@@ -66,14 +66,11 @@ ssScrollMinOnFail f sss msel = fmap (\(i, j, _) -> (i, j)) $ l <|> ssLookupMin s
|
||||
ssSetCursor ::
|
||||
(SelectionSections a -> Maybe (Int, Int, SelectionItem a)) ->
|
||||
SelectionSections a ->
|
||||
SelectionSections a
|
||||
ssSetCursor f sss = fromMaybe sss $ do
|
||||
Maybe (Int,Int) ->
|
||||
Maybe (Int,Int)
|
||||
ssSetCursor f sss msel = fromMaybe msel $ do
|
||||
(i, j, _) <- f sss
|
||||
return $
|
||||
sss
|
||||
& sssExtra . sssSelPos ?~ (i, j)
|
||||
|
||||
-- & sssSections . ix i . ssCursor ?~ SectionCursor j j (_siHeight si) (_siColor si)
|
||||
return $ Just (i, j)
|
||||
|
||||
ssLookupMax :: SelectionSections a -> Maybe (Int, Int, SelectionItem a)
|
||||
ssLookupMax sss = do
|
||||
|
||||
Reference in New Issue
Block a user