Add selection item width

This commit is contained in:
2024-11-26 21:53:49 +00:00
parent 9e0ef2ed1d
commit f12c390778
6 changed files with 26 additions and 12 deletions
+13 -7
View File
@@ -204,6 +204,7 @@ drawExamineInventory cfig w =
f str =
SelectionItem
{ _siPictures = [str]
, _siWidth = 55
, _siHeight = 1
, _siIsSelectable = True
, _siColor = white
@@ -366,7 +367,8 @@ drawTerminalDisplay tid cfig w = fromMaybe mempty $ do
(drawSelectionListBackground secondColumnParams cfig tsize)
<> color (dark $ _tmExternalColor tm) (drawTitleBackground cfig)
where
toselitm (str, col) = SelectionItem [str] 1 True col 0 ()
toselitm (str, col) = SelectionItem [str] 1 55 True col 0 ()
-- not sure if the width (55) is correct here
thesellist tm = thelist tm
thelist tm =
map toselitm . displayTermInput tm
@@ -476,17 +478,21 @@ selNumPosCardinal ::
Maybe Point2
selNumPosCardinal card cfig ldp sss i j = do
ipos <- selSecYint i j sss
size <- selSecSelSize i j sss
itmindent <- sss ^? ix i . ssItems . ix j . siOffX
sindent <- sss ^? ix i . ssIndent
-- size <- selSecSelSize i j sss
ysize <- fromIntegral <$> sss ^? ix i . ssItems . ix j . siHeight
xsize <- fromIntegral <$> sss ^? ix i . ssItems . ix j . siWidth
itmindent <- fromIntegral <$> sss ^? ix i . ssItems . ix j . siOffX
sindent <- fromIntegral <$> sss ^? ix i . ssIndent
let indent = itmindent + sindent
let offset = cardEightVec card * V2 0 (fromIntegral size * 0.5 * 20 * s)
let offset = cardEightVec card * V2
(xsize * 0.5 * 10 * s)
(ysize * 0.5 * 20 * s)
return $
screenPosAbs cfig (ldp ^. ldpPos)
+ offset
+ V2
(10 * s * fromIntegral indent)
(negate (20 * s + ygap) * (fromIntegral ipos + fromIntegral size * 0.5))
(10 * s * (indent + xsize * 0.5))
(negate (20 * s + ygap) * (fromIntegral ipos + ysize * 0.5))
where
s = _ldpScale ldp
ygap = _ldpVerticalGap ldp