Packages/FoldKit/Sources/Notation/DiagramStyle.swift
43 lines · 1862 bytes
1 symbol in this file
1/// How a `Diagram` is drawn. Lengths are in points; `lightGrey` is a grey level, 0 black to 1 white.
2///
3/// `NOTATION.md` beside the golden images records the source of each choice.
4public struct DiagramStyle: Sendable {
5 /// `B` edges and creases folded in the drawn frame.
6 public var outlineWidth: Double
7 /// Creases made earlier and flat again.
8 public var lightWidth: Double
9 public var lightGrey: Double
10 /// The step's own creases.
11 public var creaseWidth: Double
12 /// Dash, gap: a valley.
13 public var valleyDash: [Double]
14 /// Dash, gap, dot, gap, dot, gap: a mountain, drawn with butt caps.
15 public var mountainDash: [Double]
16 public var arrowWidth: Double
17 public var headLength: Double
18 /// The full head's width; a half head has one barb of half this.
19 public var headWidth: Double
20 /// The longer side of the push arrow and of the turn-over and rotate symbols.
21 public var symbolSize: Double
22
23 public init(outlineWidth: Double, lightWidth: Double, lightGrey: Double, creaseWidth: Double,
24 valleyDash: [Double], mountainDash: [Double], arrowWidth: Double, headLength: Double,
25 headWidth: Double, symbolSize: Double) {
26 self.outlineWidth = outlineWidth
27 self.lightWidth = lightWidth
28 self.lightGrey = lightGrey
29 self.creaseWidth = creaseWidth
30 self.valleyDash = valleyDash
31 self.mountainDash = mountainDash
32 self.arrowWidth = arrowWidth
33 self.headLength = headLength
34 self.headWidth = headWidth
35 self.symbolSize = symbolSize
36 }
37
38 public static let standard = DiagramStyle(
39 outlineWidth: 2, lightWidth: 1, lightGrey: 0.6, creaseWidth: 1.5,
40 valleyDash: [7, 4], mountainDash: [9, 3, 2, 3, 2, 3],
41 arrowWidth: 1.5, headLength: 14, headWidth: 10, symbolSize: 60
42 )
43}