Improve inventory display
This commit is contained in:
@@ -1,21 +1,24 @@
|
||||
module Dodge.SelectionSections.Draw
|
||||
( drawSelectionSections
|
||||
, drawSSCursor
|
||||
) where
|
||||
module Dodge.SelectionSections.Draw (
|
||||
drawSelectionSections,
|
||||
drawSSCursor,
|
||||
drawSSMultiCursor,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import Data.Maybe
|
||||
import Dodge.Data.Config
|
||||
import Dodge.Data.SelectionList
|
||||
import Dodge.Render.List
|
||||
import Dodge.ScreenPos
|
||||
import Dodge.SelectionSections
|
||||
import Picture.Base
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
|
||||
drawSelectionSections
|
||||
:: IM.IntMap (SelectionSection a)
|
||||
-> ListDisplayParams
|
||||
-> Configuration
|
||||
-> Picture
|
||||
drawSelectionSections ::
|
||||
IM.IntMap (SelectionSection a) ->
|
||||
ListDisplayParams ->
|
||||
Configuration ->
|
||||
Picture
|
||||
drawSelectionSections sss ldp cfig =
|
||||
translateScreenPos cfig (ldp ^. ldpPos) $
|
||||
drawListYgapScaleYoff
|
||||
@@ -24,13 +27,45 @@ drawSelectionSections sss ldp cfig =
|
||||
0
|
||||
(foldMap _ssShownItems sss)
|
||||
|
||||
drawSSCursor
|
||||
:: IM.IntMap (SelectionSection a)
|
||||
-> Maybe (Int,Int)
|
||||
-> ListDisplayParams
|
||||
-> CursorDisplay
|
||||
-> Configuration
|
||||
-> Picture
|
||||
drawSSCursor ::
|
||||
IM.IntMap (SelectionSection a) ->
|
||||
Maybe (Int, Int) ->
|
||||
ListDisplayParams ->
|
||||
CursorDisplay ->
|
||||
Configuration ->
|
||||
Picture
|
||||
drawSSCursor sss msel ldp curs cfig =
|
||||
translateScreenPos cfig (ldp ^. ldpPos) $
|
||||
selSecDrawCursor 15 ldp curs sss msel
|
||||
selSecDrawCursor 15 ldp curs sss msel
|
||||
|
||||
drawSSMultiCursor ::
|
||||
IM.IntMap (SelectionSection a) ->
|
||||
Maybe (Int, Int) ->
|
||||
Maybe Int ->
|
||||
ListDisplayParams ->
|
||||
CursorDisplay ->
|
||||
Configuration ->
|
||||
Picture
|
||||
drawSSMultiCursor sss msel mextra ldp curs cfig = translateScreenPos cfig (ldp ^. ldpPos)
|
||||
. fromMaybe mempty
|
||||
$ do
|
||||
(i, j) <- msel
|
||||
yint <- selSecYint i j sss
|
||||
xint <- sss ^? ix i . ssIndent
|
||||
ydown <- mextra
|
||||
ssitms <- sss ^? ix i . ssItems
|
||||
let selitms = fst . IM.split (j + ydown + 1) . snd . IM.split (j -1) $ ssitms
|
||||
ysize = sum . fmap _siHeight $ selitms
|
||||
maxoff = maximum . fmap _siOffX $ selitms
|
||||
minoff = minimum . fmap _siOffX $ selitms
|
||||
col <- fmap (_siColor . fst) $ IM.minView selitms
|
||||
return $
|
||||
listCursorChooseBorderScale
|
||||
(ldp ^. ldpVerticalGap)
|
||||
(ldp ^. ldpScale)
|
||||
curs
|
||||
yint
|
||||
(xint + minoff)
|
||||
col
|
||||
(15 + maxoff - minoff)
|
||||
ysize
|
||||
|
||||
Reference in New Issue
Block a user