Fix cursor positioning in selection sections
This commit is contained in:
@@ -4,6 +4,7 @@ module Dodge.Combine (
|
||||
combineList',
|
||||
) where
|
||||
|
||||
import Dodge.Item.SlotsTaken
|
||||
import Dodge.Data.Universe
|
||||
import Dodge.Data.Combine
|
||||
import Dodge.Item.Display
|
||||
@@ -54,7 +55,7 @@ combineList' = map f . combineListInfo
|
||||
where
|
||||
f (is,(strs,itm)) = SelectionItem
|
||||
{ _siPictures = basicItemDisplay itm
|
||||
, _siHeight = length (basicItemDisplay itm)
|
||||
, _siHeight = itSlotsTaken itm
|
||||
, _siIsSelectable = True
|
||||
, _siColor = _itInvColor itm
|
||||
, _siOffX = 0
|
||||
|
||||
@@ -195,10 +195,11 @@ updateSection sis mcsel availablelines ss =
|
||||
scurs = do
|
||||
csel <- mcsel
|
||||
(_, si) <- IM.lookupGE csel sis -- this is not right?
|
||||
let cpos = sum (fmap (length . _siPictures) . fst . IM.split csel $ sis)
|
||||
let cpos = sum (fmap ( _siHeight) . fst . IM.split csel $ sis)
|
||||
csize = length $ _siPictures si
|
||||
ccolor = _siColor si
|
||||
return $ SectionCursor (cpos - offset) csize ccolor
|
||||
--return $ SectionCursor (cpos - offset) 1 ccolor
|
||||
nocursoroffset =
|
||||
if length allstrings - oldoffset <= availablelines
|
||||
then max 0 (length allstrings - availablelines)
|
||||
@@ -245,7 +246,7 @@ updateSection sis mcsel availablelines ss =
|
||||
allstrings = IM.elems $ overlapSelectionItems $ IM.elems sis
|
||||
shownstrings = drop offset allstrings
|
||||
--h (col, str) = color col . text $ theindent ++ str
|
||||
h (col, str) = translate (fromIntegral (_ssIndent ss) * 10) 0 str
|
||||
h (col, str) = translate (fromIntegral (_ssIndent ss) * 100) 0 str
|
||||
theindent = replicate (_ssIndent ss) ' '
|
||||
--xtra str = color white . text $ theindent ++ str ++ " MORE " ++ _ssDescriptor ss
|
||||
g si = map (_siColor si,) $ _siPictures si
|
||||
@@ -305,7 +306,7 @@ enterCombineInv cfig w =
|
||||
{ _ssItems = cm
|
||||
, _ssCursor = do
|
||||
(_, si) <- IM.lookupMin cm
|
||||
return $ SectionCursor 0 (length (_siPictures si)) (_siColor si)
|
||||
return $ SectionCursor 0 (_siHeight si) (_siColor si)
|
||||
, _ssMinSize = 5
|
||||
, _ssOffset = 0
|
||||
, _ssShownItems = mempty
|
||||
|
||||
@@ -86,7 +86,8 @@ stackPicturesAtOff i = mconcat . zipWith (drawListElement 10 1 0) [i, i -1 ..]
|
||||
selSecDrawCursor :: Int -> ListDisplayParams -> SelectionSections a -> Picture
|
||||
selSecDrawCursor xsize ldp sss = fromMaybe mempty $ do
|
||||
(i, j) <- sss ^? sssExtra . sssSelPos . _Just
|
||||
yint <- selSecYint i j sss
|
||||
--yint <- selSecYint i j sss
|
||||
yint <- sss ^? sssSections . ix i . ssCursor . _Just . scurPos
|
||||
xint <- sss ^? sssSections . ix i . ssIndent
|
||||
si <- sss ^? sssSections . ix i . ssItems . ix j
|
||||
return $
|
||||
@@ -98,7 +99,7 @@ selSecDrawCursor xsize ldp sss = fromMaybe mempty $ do
|
||||
xint
|
||||
(_siColor si)
|
||||
xsize
|
||||
(length $ _siPictures si)
|
||||
(_siHeight si)
|
||||
|
||||
-- displays a cursor that should match up to list text pictures
|
||||
listCursorChooseBorderScale ::
|
||||
|
||||
Reference in New Issue
Block a user