Fix indentation display of indented sections
This commit is contained in:
@@ -138,18 +138,18 @@ updateDisplaySections w cfig =
|
||||
(filtinv, invx) = ((-1, sfinv), (0, sinv))
|
||||
closefiltcurs = mselpos ^? _Just . _1 == Just 2
|
||||
(sfclose, sclose) =
|
||||
filterSectionsPair closefiltcurs plainRegex closeitms "NEARBY" $
|
||||
filterSectionsPair closefiltcurs plainRegex closeitms "NEARBY ITEMS" $
|
||||
w ^? hud . hudElement . diCloseFilter . _Just
|
||||
(filtclose, closex) = ((2, sfclose), (3, sclose))
|
||||
nearbyhead = if null sfclose
|
||||
then if null sclose then (2,mempty) else makehead "NEARBY" 2
|
||||
then if null sclose then (2,mempty) else makehead "NEARBY ITEMS" 2
|
||||
else filtclose
|
||||
youx = (1, youitems)
|
||||
makehead str i = (i,IM.singleton 0 $ SelectionInfo [str] 1 False white 0)
|
||||
statushead = (-4,IM.singleton 0 $ SelectionInfo ["STATUS"] 1 False white 0)
|
||||
statusdisplay = (-3,IM.singleton 0 $ SelectionInfo ["HEALTH "++show (_crHP cr)] 1 False white 0)
|
||||
invhead = if null sfinv then makehead "INVENTORY" (-2) else filtinv
|
||||
youitems = IM.singleton 0 $ SelectionItem [thetext] 1 True invDimColor 0 ()
|
||||
youitems = IM.singleton 0 $ SelectionItem [thetext] 1 True invDimColor 2 ()
|
||||
thetext = displayFreeSlots (crNumFreeSlots cr)
|
||||
closeitms =
|
||||
IM.fromDistinctAscList . zip [0 ..] $
|
||||
|
||||
@@ -457,7 +457,9 @@ selNumPosCardinal ::
|
||||
selNumPosCardinal card cfig ldp sss i j = do
|
||||
ipos <- selSecYint i j sss
|
||||
size <- selSecSelSize i j sss
|
||||
indent <- sss ^? ix i . ssItems . ix j . siOffX
|
||||
itmindent <- sss ^? ix i . ssItems . ix j . siOffX
|
||||
sindent <- sss ^? ix i . ssIndent
|
||||
let indent = itmindent + sindent
|
||||
let offset = cardEightVec card * V2 0 (fromIntegral size * 0.5 * 20 * s)
|
||||
return $
|
||||
screenPosAbs cfig (ldp ^. ldpPos)
|
||||
|
||||
@@ -67,6 +67,7 @@ makeSelectionListPictures = concatMap f
|
||||
where
|
||||
f si = map (color (_siColor si) . text) $ _siPictures si
|
||||
|
||||
-- note this does not take into account any selectionsection indent
|
||||
drawCursorAt ::
|
||||
Maybe Int ->
|
||||
[SelectionItem a] ->
|
||||
@@ -113,6 +114,7 @@ selSecDrawCursorAt ::
|
||||
Picture
|
||||
selSecDrawCursorAt xsize ldp curs sss (i, j) = fold $ do
|
||||
yint <- selSecYint i j sss
|
||||
sindent <- sss ^? ix i . ssIndent
|
||||
si <- sss ^? ix i . ssItems . ix j
|
||||
return $
|
||||
listCursorChooseBorderScale
|
||||
@@ -120,7 +122,7 @@ selSecDrawCursorAt xsize ldp curs sss (i, j) = fold $ do
|
||||
(ldp ^. ldpScale)
|
||||
curs
|
||||
yint
|
||||
(_siOffX si)
|
||||
(_siOffX si + sindent)
|
||||
(_siColor si)
|
||||
xsize
|
||||
(_siHeight si)
|
||||
|
||||
@@ -25,7 +25,8 @@ drawSelectionSections sss ldp cfig =
|
||||
(_ldpVerticalGap ldp)
|
||||
(_ldpScale ldp)
|
||||
0
|
||||
(foldMap _ssShownItems sss)
|
||||
(foldMap
|
||||
(\ss -> fmap (translate (100*fromIntegral (_ssIndent ss)) 0) $ _ssShownItems ss) sss)
|
||||
|
||||
drawSSCursor ::
|
||||
IM.IntMap (SelectionSection a) ->
|
||||
@@ -53,6 +54,7 @@ drawSSMultiCursor sss msel mextra ldp curs cfig = translateScreenPos cfig (ldp ^
|
||||
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
|
||||
@@ -65,7 +67,7 @@ drawSSMultiCursor sss msel mextra ldp curs cfig = translateScreenPos cfig (ldp ^
|
||||
(ldp ^. ldpScale)
|
||||
curs
|
||||
yint
|
||||
minxoff
|
||||
(minxoff + sindent)
|
||||
col
|
||||
(15 + maxxoff - minxoff)
|
||||
(sindent + 15 + maxxoff - minxoff)
|
||||
ysize
|
||||
|
||||
Reference in New Issue
Block a user