Clicking on button in inventory list activates button
This commit is contained in:
+11
-12
@@ -34,26 +34,25 @@ import Picture
|
||||
|
||||
drawSelectionList :: LDParams -> Config -> [SelectionItem a] -> Picture
|
||||
drawSelectionList ldps cfig sl =
|
||||
translateScreenPos cfig (ldps ^. ldpPos) $
|
||||
drawListYgapScaleYoff ygap sf 0 (makeSelectionListPictures sl)
|
||||
<> foldMap (g . f) (ldps ^. ldpBorder)
|
||||
translateScreenPos
|
||||
cfig
|
||||
(ldps ^. ldpPos)
|
||||
(drawListYgapScaleYoff ygap sf 0 (makeSelectionListPictures sl))
|
||||
<> foldMap (g . f) (ldpRect cfig ldps)
|
||||
where
|
||||
g xs = color white (polygonWire xs) <> setDepth 0.5 (polygon xs)
|
||||
ygap = ldps ^. ldpVerticalGap
|
||||
sf = ldps ^. ldpScale
|
||||
f (x, y) =
|
||||
rectNSWE
|
||||
5
|
||||
(negate $ (20 * sf + ygap) * fromIntegral y + 5)
|
||||
(-5)
|
||||
(10 * sf * fromIntegral x)
|
||||
f (V2 xmin ymax, V2 xmax ymin) = rectNSWE ymax ymin xmin xmax
|
||||
|
||||
ldpRect :: Config -> LDParams -> Maybe (Point2, Point2) -- (NW, SE)
|
||||
ldpRect cfig ldp = do
|
||||
(x,y) <- ldp ^? ldpBorder . _Just
|
||||
return $ ( V2 (-5) 5
|
||||
(x, y) <- ldp ^? ldpBorder . _Just
|
||||
return $
|
||||
( V2 (-5) 5
|
||||
, V2 (10 * sf * fromIntegral x) (negate $ (20 * sf + ygap) * fromIntegral y + 5)
|
||||
) & each +~ screenPosAbs cfig (ldp ^. ldpPos)
|
||||
)
|
||||
& each +~ screenPosAbs cfig (ldp ^. ldpPos)
|
||||
where
|
||||
sf = ldp ^. ldpScale
|
||||
ygap = ldp ^. ldpVerticalGap
|
||||
|
||||
Reference in New Issue
Block a user