Add hacky block shadow to inventory items

This commit is contained in:
2025-12-26 10:41:21 +00:00
parent b9a6bd5f67
commit 2cb9fb153a
5 changed files with 188 additions and 181 deletions
+3
View File
@@ -37,6 +37,8 @@ data SelSection a = SelSection
type IMSS a = IntMap (SelSection a)
type IMSI a = IntMap (SelectionItem a)
data SelectionWidth = FixedSelectionWidth Int | UseItemWidth
data SelectionItem a = SelItem
@@ -53,6 +55,7 @@ data SelectionItem a = SelItem
data SIDisplayMod
= NoSIDisplayMod
| HighlightSI
| DropShadowSI
makeLenses ''LDParams
makeLenses ''SelectionItem
+6 -11
View File
@@ -259,13 +259,7 @@ updateSectionsPositioning h mselpos allavailablelines lsss sss =
lk = mselpos ^.. _Just . slSec
ssizes = sectionsSizes allavailablelines lk $ sectionsDesiredLines ls
updateSection ::
Int ->
Maybe Int ->
IM.IntMap (SelectionItem a) ->
Int ->
Int ->
SelSection a
updateSection :: Int -> Maybe Int -> IMSI a -> Int -> Int -> SelSection a
updateSection indent mcsel sis availablelines oldoffset =
SelSection
{ _ssItems = sis
@@ -305,10 +299,11 @@ updateSection indent mcsel sis availablelines oldoffset =
listSelectionColorPicture :: SelectionItem a -> ([Picture], Sum Int)
listSelectionColorPicture si = (g <$> _siPictures si, Sum $ _siHeight si)
where
textf = case si ^. siDisplayMod of
NoSIDisplayMod -> text
HighlightSI -> hackBoldText
g = translate lindent 0 . color (_siColor si) . textf
g = translate lindent 0 . case si ^. siDisplayMod of
NoSIDisplayMod -> docolor . text
HighlightSI -> docolor . hackBoldText
DropShadowSI -> hackDropShadow (si ^. siColor) black
docolor = color (si ^. siColor)
lindent = 100 * fromIntegral (_siOffX si)
regexList :: String -> [String] -> Bool
+1 -1
View File
@@ -42,7 +42,7 @@ invSelectionItem w indent loc =
, _siDisplayMod = dmod
}
where
dmod = maybe NoSIDisplayMod (const HighlightSI)
dmod = maybe DropShadowSI (const HighlightSI)
$ w ^? cWorld . highlightItems . ix (a ^. itID . unNInt)
ci = (a,b)
(a,b,_) = loc ^. locDT . dtValue
+6
View File
@@ -26,6 +26,7 @@ module Picture.Base (
lineCol,
text,
hackBoldText,
hackDropShadow,
textRight,
textJustifyLeft,
textJustifyRight,
@@ -198,6 +199,11 @@ text = drawText 0
hackBoldText :: String -> Picture
hackBoldText s = text s <> translate 10 0 (text s)
hackDropShadow :: Color -> Color -> String -> Picture
hackDropShadow c1 c2 s = color c2 (translate 10 (-10) (text s))
-- <> color c2 (translate (-10) 10 (text s))
<> color c1 (text s)
-- lines up the rightmost part of the last character with 0
textJustifyRight :: String -> Picture
{-# INLINE textJustifyRight #-}