Push more data out of selection list into menu screen
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
module Dodge.SelectionList where
|
||||
|
||||
--import Color
|
||||
--import Dodge.WindowLayout
|
||||
import Dodge.Data.Universe
|
||||
import LensHelp
|
||||
import Data.Maybe
|
||||
|
||||
setShownSelectionItems :: ScreenLayer -> ScreenLayer
|
||||
setShownSelectionItems sl = fromMaybe sl $ do
|
||||
setShownSelectionItems :: Configuration -> ScreenLayer -> ScreenLayer
|
||||
setShownSelectionItems cfig sl = fromMaybe sl $ do
|
||||
offset <- sl ^? scOffset
|
||||
return $ sl & scSelectionList %~ setShownSelectionItems' offset
|
||||
maxlines <- sl ^? scAvailableLines
|
||||
return $ sl & scSelectionList %~ setShownSelectionItems' maxlines offset
|
||||
|
||||
setShownSelectionItems' :: Int -> SelectionList -> SelectionList
|
||||
setShownSelectionItems' offset sl = case sl ^? slSizeRestriction of
|
||||
Just (SelectionSizeRestriction maxlines _ botit _)
|
||||
setShownSelectionItems' :: Int -> Int -> SelectionList -> SelectionList
|
||||
setShownSelectionItems' maxlines offset sl = case sl ^? slSizeRestriction of
|
||||
Just (SelectionSizeRestriction botit)
|
||||
| length allitems > maxlines ->
|
||||
sl & slShownItems .~ take (maxlines - 2) (drop offset allitems) -- ++ repeat dummyitem))
|
||||
++ [(botit,ScrollSelectionItem)]
|
||||
|
||||
Reference in New Issue
Block a user