4 struct MapStages: View {
12 ZStack(alignment: .topLeading) {
14 design: .constant(.stitch), pixelSize: 1.0, foregroundColor: .map.stageForeground,
15 backgroundColor: .map.stageBackground
17 .frame(width: w(stages[0]), height: mapSize.height)
19 design: .constant(.shingles), pixelSize: 1.0, foregroundColor: .map.stageForeground,
20 backgroundColor: .map.stageBackground
22 .offset(CGSize(width: w(stages[0]), height: 0))
23 .frame(width: w(stages[1]) - w(stages[0]), height: mapSize.height)
25 design: .constant(.shadowGrid), pixelSize: 1.0, foregroundColor: .map.stageForeground,
26 backgroundColor: .map.stageBackground
28 .offset(CGSize(width: w(stages[1]), height: 0))
29 .frame(width: w(stages[2]) - w(stages[1]), height: mapSize.height)
31 design: .constant(.wicker), pixelSize: 1.0, foregroundColor: .map.stageForeground,
32 backgroundColor: .map.stageBackground
34 .offset(CGSize(width: w(stages[2]), height: 0))
35 .frame(width: mapSize.width - w(stages[2]), height: mapSize.height)
38 path.move(to: CGPoint(x: w(stages[0]), y: 0))
39 path.addLine(to: CGPoint(x: w(stages[0]), y: mapSize.height))
41 path.move(to: CGPoint(x: w(stages[1]), y: 0))
42 path.addLine(to: CGPoint(x: w(stages[1]), y: mapSize.height))
44 path.move(to: CGPoint(x: w(stages[2]), y: 0))
45 path.addLine(to: CGPoint(x: w(stages[2]), y: mapSize.height))
47 path.move(to: CGPoint(x: w(stages[0]), y: 0))
49 }.strokedPath(StrokeStyle(lineWidth: lineWidth / 4, dash: [10.0, 18.0])).stroke(
54 func w(_ dimension: CGFloat) -> CGFloat {
55 max(0.0, min(mapSize.width, dimension * mapSize.width / 100.0))
61 mapSize: CGSize(width: 200.0, height: 200.0), lineWidth: CGFloat(0.5),
62 stages: [25.0, 50.0, 75.0])