0 | module CyBy.Draw.Internal.Settings
2 | import CyBy.Draw.Internal.Abbreviations
3 | import CyBy.Draw.Internal.Color
4 | import CyBy.Draw.Internal.CoreDims
6 | import Derive.Prelude
11 | %language ElabReflection
18 | record DrawSettings where
22 | abbreviations : List Abbreviation
23 | bondColor : SVGColor
24 | defaultBG : SVGColor
26 | highlightBG : SVGColor
33 | textColor : SVGColor
34 | elemColor : Elem -> SVGColor
38 | resizeCornerRad : Double
41 | defaultSettings : List Abbreviation -> DrawSettings
42 | defaultSettings as =
45 | , core = defaultCore
46 | , hoverBG = RGBA 71 112 204 50.perc
47 | , originBG = RGB 132 197 98
49 | , selectBG = RGBA 132 197 98 50.perc
50 | , selectFG = RGBA 132 197 98 50.perc
52 | , highlightBG = lightgreen
53 | , errorBG = RGB 255 150 150
55 | , elemColor = basicColors
61 | , resizeCornerRad = 20.0
64 | export %inline %hint
65 | toCoreDims : (ds : DrawSettings) => CoreDims
66 | toCoreDims = ds.core
69 | (.selectBufferV) : DrawSettings -> Vector Id
70 | s.selectBufferV = vid s.core.selectBufferSize s.core.selectBufferSize
75 | validScale : (s : DrawSettings) => AffineTransformation -> Scale -> Scale
77 | let tot := sc * t.transform.scale
78 | validTot := min (max tot s.minZoom) s.maxZoom
79 | False := validTot == tot | True => sc
80 | in sc * scale (validTot.value / tot.value)