68 lines
2.0 KiB
Haskell
68 lines
2.0 KiB
Haskell
module Dodge.SelectionSections.Draw (
|
|
drawSelectionSections,
|
|
drawSSCursor,
|
|
drawSSMultiCursor,
|
|
) where
|
|
|
|
import Dodge.Data.HUD
|
|
import Control.Lens
|
|
import qualified Data.IntMap.Strict as IM
|
|
import Dodge.Data.Config
|
|
import Dodge.Data.SelectionList
|
|
import Dodge.Render.List
|
|
import Dodge.ScreenPos
|
|
import Dodge.SelectionSections
|
|
import Picture.Base
|
|
|
|
drawSelectionSections :: IM.IntMap (SelSection a) -> LDParams -> Config -> Picture
|
|
drawSelectionSections sss ldp cfig =
|
|
translateScreenPos cfig (ldp ^. ldpPos) $
|
|
drawListYgapScaleYoff
|
|
(_ldpVerticalGap ldp)
|
|
(_ldpScale ldp)
|
|
0
|
|
( foldMap
|
|
( \ss ->
|
|
translate (100 * fromIntegral (_ssIndent ss)) 0
|
|
<$> _ssShownItems ss
|
|
)
|
|
sss
|
|
)
|
|
|
|
drawSSCursor ::
|
|
IM.IntMap (SelSection a) -> LDParams -> CursorDisplay -> Config -> Selection -> Picture
|
|
drawSSCursor sss ldp curs cfig =
|
|
translateScreenPos cfig (ldp ^. ldpPos) .
|
|
selSecDrawCursor ldp curs sss
|
|
|
|
drawSSMultiCursor ::
|
|
IM.IntMap (SelSection a) ->
|
|
Maybe (Int, Int) ->
|
|
Maybe Int ->
|
|
LDParams ->
|
|
CursorDisplay ->
|
|
Config ->
|
|
Picture
|
|
drawSSMultiCursor sss msel mextra ldp curs cfig = translateScreenPos cfig (ldp ^. ldpPos)
|
|
. fold
|
|
$ do
|
|
(i, j) <- msel
|
|
yint <- selSecYint i j sss
|
|
ydown <- mextra
|
|
ssitms <- sss ^? ix i . ssItems
|
|
sindent <- sss ^? ix i . ssIndent
|
|
let selitms = fst . IM.split (j + ydown + 1) . snd . IM.split (j -1) $ ssitms
|
|
ysize = sum . fmap _siHeight $ selitms
|
|
maxxoff = maximum . fmap _siOffX $ selitms
|
|
minxoff = minimum . fmap _siOffX $ selitms
|
|
return $
|
|
listCursorChooseBorderScale
|
|
(ldp ^. ldpVerticalGap)
|
|
(ldp ^. ldpScale)
|
|
curs
|
|
yint
|
|
(minxoff + sindent)
|
|
white
|
|
(15 + maxxoff - minxoff)
|
|
ysize
|