Simplify button drawing

This commit is contained in:
2025-06-25 15:40:12 +01:00
parent bf0bc22720
commit 6e9d4918a1
9 changed files with 40 additions and 46 deletions
+7 -5
View File
@@ -5,12 +5,14 @@ import Dodge.Data.Button
import Geometry
import Shape
import ShapePicture
import Control.Lens
drawButton :: ButtonDraw -> Button -> SPic
drawButton bd = case bd of
DefaultDrawButton col -> defaultDrawButton col
DefaultDrawSwitch col1 col2 -> drawSwitch col1 col2
DrawNoButton -> const mempty
drawButton :: Button -> SPic
drawButton bt = case bt ^. btEvent of
ButtonPress {_bpColor = col} -> defaultDrawButton col bt
ButtonSimpleSwith {_bssColor1 = col1, _bssColor2 = col2} -> drawSwitch col1 col2 bt
ButtonAccessTerminal -> mempty
ButtonDoNothing -> mempty
drawSwitch :: Color -> Color -> Button -> SPic
drawSwitch col1 col2 bt