Cleanup
This commit is contained in:
+10
-2
@@ -30,7 +30,7 @@ moveSelectionMapStep :: Int -> SelectionIntMap a -> SelectionIntMap a
|
||||
moveSelectionMapStep x sm = fromMaybe sm $ do
|
||||
i <- _smSelPos sm
|
||||
(n,_) <- IM.lookupMax (sm ^. smShownItems)
|
||||
let j = (i + x) `mod` (n + 1)
|
||||
let j = (i - x) `mod` (n + 1)
|
||||
case sm ^? smShownItems . ix j . siIsSelectable of
|
||||
Just True -> Just $ sm & smSelPos ?~ j
|
||||
_ -> Just $ moveSelectionMapStep x (sm & smSelPos ?~ j)
|
||||
@@ -38,6 +38,14 @@ moveSelectionMapStep x sm = fromMaybe sm $ do
|
||||
moveSelectionMapSelection :: Int -> SelectionIntMap a -> SelectionIntMap a
|
||||
moveSelectionMapSelection i sm = foldl'
|
||||
(&)
|
||||
sm
|
||||
sm
|
||||
(replicate (abs i) (moveSelectionMapStep (signum i)))
|
||||
|
||||
getIthPos :: Int -> IM.IntMap (SelectionItem a) -> Int
|
||||
getIthPos i sm = sum . fmap _siHeight . fst $ IM.split i sm
|
||||
|
||||
getIthYOffset :: Float -> Float -> SelectionIntMap a -> Int -> Float
|
||||
getIthYOffset ygap scale sm i = (scale * 10 + ygap) * (fromIntegral yint + 1)
|
||||
where
|
||||
yint = getIthPos i (sm ^. smShownItems)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user