Remove SelectionIntMap

This commit is contained in:
2023-02-19 09:59:09 +00:00
parent 8ec1dc0830
commit a88755bd75
8 changed files with 6 additions and 118 deletions
-35
View File
@@ -2,7 +2,6 @@ module Dodge.Render.List where
--import Picture.Text
import Dodge.Inventory
import SelectionIntMap
import qualified Data.IntMap.Strict as IM
--import Data.Foldable
import Dodge.SelectionList
@@ -29,29 +28,12 @@ drawSelectionList ldps cfig sl =
(makeSelectionListPictures sl)
<> drawSelectionCursor ldps cfig sl
drawSelectionMap :: ListDisplayParams -> Configuration -> SelectionIntMap a -> Picture
drawSelectionMap ldps cfig sl =
listPicturesAtScaleOff
(_ldpVerticalGap ldps)
(_ldpScale ldps)
(_ldpPosX ldps)
(_ldpPosY ldps)
cfig
0 --(_slOffset sl)
(makeSelectionMapPictures sl)
<> drawSelectionMapCursor ldps cfig sl
makeSelectionListPictures :: SelectionList a -> [Picture]
makeSelectionListPictures sl = concatMap f $ getShownItems sl
where
f si = map (color (_siColor si) . text) $ _siPictures si
--f si = map (textGrad (_siColor si) (withAlpha 0 (_siColor si))) $ _siPictures si
makeSelectionMapPictures :: SelectionIntMap a -> [Picture]
makeSelectionMapPictures sl = foldMap f $ _smShownItems sl
where
f si = map (color (_siColor si) . text) $ _siPictures si
drawCursorAt :: ListDisplayParams -> Configuration -> Maybe Int -> [SelectionItem a] -> Picture
drawCursorAt ldps cfig mi lis = fromMaybe mempty $ do
i <- mi
@@ -67,23 +49,6 @@ drawCursorAt ldps cfig mi lis = fromMaybe mempty $ do
FixedSelectionWidth x -> x
_ -> 1
drawCursorAt' :: ListDisplayParams -> Configuration -> Int -> IM.IntMap (SelectionItem a) -> Picture
drawCursorAt' ldps cfig i lis = fromMaybe mempty $ do
selit <- lis IM.!? i
f <- case _ldpCursorType ldps of
BorderCursor cps -> Just $ listCursorChooseBorderScale (_ldpVerticalGap ldps) (_ldpScale ldps) cps
NoCursor -> Nothing
let j = getIthPos i lis
col = _siColor selit
return $ f (_ldpPosX ldps + (9 * fromIntegral (_siOffX selit))) (_ldpPosY ldps) cfig j 0 col wdth (_siHeight selit)
where
wdth = case _ldpWidth ldps of
FixedSelectionWidth x -> x
_ -> 1
drawSelectionMapCursor :: ListDisplayParams -> Configuration -> SelectionIntMap a -> Picture
drawSelectionMapCursor ldps cfig sl = drawCursorAt ldps cfig (sl ^. smSelPos) (IM.elems $ _smShownItems sl)
drawSelectionCursor :: ListDisplayParams -> Configuration -> SelectionList a -> Picture
drawSelectionCursor ldps cfig sl = drawCursorAt ldps cfig (f $ sl ^. slSelPos) (getShownItems sl)
where