Add selection item width
This commit is contained in:
@@ -24,6 +24,7 @@ combineList = map f . combineItemListYouX
|
||||
SelectionItem
|
||||
{ _siPictures = basicItemDisplay itm
|
||||
, _siHeight = _itInvSize itm
|
||||
, _siWidth = 15
|
||||
, _siIsSelectable = True
|
||||
, _siColor = itemInvColor . pciToCI $ basePCI itm
|
||||
, _siOffX = 0
|
||||
|
||||
@@ -45,6 +45,7 @@ data SelectionItem a
|
||||
= SelectionItem
|
||||
{ _siPictures :: [String]
|
||||
, _siHeight :: Int
|
||||
, _siWidth :: Int
|
||||
, _siIsSelectable :: Bool
|
||||
, _siColor :: Color
|
||||
, _siOffX :: Int
|
||||
@@ -53,6 +54,7 @@ data SelectionItem a
|
||||
| SelectionInfo
|
||||
{ _siPictures :: [String]
|
||||
, _siHeight :: Int
|
||||
, _siWidth :: Int
|
||||
, _siIsSelectable :: Bool
|
||||
, _siColor :: Color
|
||||
, _siOffX :: Int
|
||||
|
||||
@@ -170,11 +170,11 @@ updateDisplaySections w cfig =
|
||||
btitems =
|
||||
IM.fromDistinctAscList . zip [0 ..] $
|
||||
mapMaybe (closeButtonToSelectionItem w) (w ^. hud . closeButtons)
|
||||
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)
|
||||
makehead str i = (i, IM.singleton 0 $ SelectionInfo [str] 1 15 False white 0)
|
||||
statushead = (-4, IM.singleton 0 $ SelectionInfo ["STATUS"] 1 15 False white 0)
|
||||
statusdisplay = (-3, IM.singleton 0 $ SelectionInfo ["HEALTH: " ++ show (_crHP cr)] 1 15 False white 0)
|
||||
invhead = if null sfinv then makehead "INVENTORY" (-1) else filtinv
|
||||
youitems = IM.singleton 0 $ SelectionItem [thetext] 1 True invDimColor 2 ()
|
||||
youitems = IM.singleton 0 $ SelectionItem [thetext] 1 15 True invDimColor 2 ()
|
||||
thetext = displayFreeSlots (crNumFreeSlots cr)
|
||||
closeitms =
|
||||
IM.fromDistinctAscList . zip [0 ..] $
|
||||
@@ -207,6 +207,7 @@ filterSectionsPair infocus filtfn itms filtdescription mfilt = (filtsis, itms')
|
||||
$ SelectionInfo
|
||||
[filtdescription ++ " FILTER/" ++ str ++ [filtcurs], numfiltitems]
|
||||
2
|
||||
15
|
||||
True
|
||||
white
|
||||
0
|
||||
@@ -370,7 +371,7 @@ enterCombineInv cfig w =
|
||||
cm
|
||||
| null cm' =
|
||||
IM.singleton 0 $
|
||||
SelectionInfo ["No possible combinations"] 1 False white 0
|
||||
SelectionInfo ["No possible combinations"] 1 25 False white 0
|
||||
| otherwise = cm'
|
||||
selpos
|
||||
| null cm' = Nothing
|
||||
|
||||
@@ -23,6 +23,7 @@ invSelectionItem indent cr i ci =
|
||||
SelectionItem
|
||||
{ _siPictures = pics & ix 0 %~ (++ anyequippos ++ anyhotkey)
|
||||
, _siHeight = _itInvSize $ _cItem ci
|
||||
, _siWidth = 15
|
||||
, _siIsSelectable = True
|
||||
, _siColor = col
|
||||
, _siOffX = indent
|
||||
@@ -57,6 +58,7 @@ closeItemToSelectionItem w (NInt i) = do
|
||||
SelectionItem
|
||||
{ _siPictures = pics
|
||||
, _siHeight = length pics
|
||||
, _siWidth = 15
|
||||
, _siIsSelectable = True
|
||||
, _siColor = col
|
||||
, _siOffX = 0
|
||||
@@ -70,6 +72,7 @@ closeButtonToSelectionItem w i = do
|
||||
SelectionItem
|
||||
{ _siPictures = [_btText bt]
|
||||
, _siHeight = 1
|
||||
, _siWidth = 15
|
||||
, _siIsSelectable = True
|
||||
, _siColor = yellow
|
||||
, _siOffX = 0
|
||||
|
||||
@@ -100,6 +100,7 @@ menuOptionToSelectionItem w padAmount mo =
|
||||
SelectionItem
|
||||
{ _siPictures = [optionText]
|
||||
, _siHeight = 1
|
||||
, _siWidth = 50
|
||||
, _siIsSelectable = isselectable
|
||||
, _siColor = thecol
|
||||
, _siOffX = 0
|
||||
|
||||
+13
-7
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user