module Dodge.SelectionList ( getShownItems, getAvailableListLines, ) where import Dodge.Data.ScreenPos import Dodge.Data.Universe import LensHelp import Linear getAvailableListLines :: ListDisplayParams -> Configuration -> Int getAvailableListLines ldps cfig = floor ((dToBot - vgap) / itmHeight) where vgap = ldps ^. ldpVerticalGap itmHeight = 20 * ldps ^. ldpScale + vgap winy = fromIntegral $ cfig ^. windowY dToBot = winy / 2 + winy * (ldps ^. ldpPos . spScreenOff . _y) + (ldps ^. ldpPos . spPixelOff . _y) getShownItems :: SelectionList a -> [SelectionItem a] getShownItems sl = case sl ^. slRegexList of [] -> sl ^. slItems xs -> fmap fst xs