5 @Environment(\.colorScheme) var colorScheme
11 let stageHeight = CGFloat(50.0)
12 let padding = CGFloat(5.0)
15 MapColor.colorForScheme(colorScheme).foreground
19 ZStack(alignment: .topLeading) {
23 path.move(to: CGPoint(x: 0, y: 0))
24 path.addLine(to: CGPoint(x: 0, y: mapSize.height))
25 path.addLine(to: CGPoint(x: mapSize.width, y: mapSize.height))
26 path.move(to: CGPoint(x: mapSize.width, y: mapSize.height))
28 }.stroke(color, lineWidth: lineWidth * 2)
31 Text("Visible").font(.title3).foregroundColor(color).rotationEffect(Angle(degrees: -90.0))
32 .offset(CGSize(width: -35.0, height: 0.0))
33 Text("Value Chain").font(.title).foregroundColor(color).rotationEffect(Angle(degrees: -90.0))
34 .offset(CGSize(width: -72.0, height: mapSize.height / 2 - 20))
35 Text("Invisible").font(.title3).foregroundColor(color).rotationEffect(Angle(degrees: -90.0))
36 .offset(CGSize(width: -40.0, height: mapSize.height - 20))
42 .foregroundColor(color)
43 .frame(width: mapSize.width / 4, height: stageHeight, alignment: .topLeading)
44 .offset(CGSize(width: 0.0, height: -stageHeight / 2.0))
45 Text("Industrialised")
47 .foregroundColor(color)
48 .frame(width: mapSize.width / 4, height: stageHeight, alignment: .topLeading)
49 .offset(CGSize(width: mapSize.width - 100.0, height: -stageHeight / 2.0))
53 .foregroundColor(color)
54 .frame(width: w(stages[0]), height: stageHeight, alignment: .topLeading)
55 .offset(CGSize(width: 0.0, height: mapSize.height + padding))
59 .foregroundColor(color)
60 .frame(width: w(stages[1]) - w(stages[0]), height: stageHeight, alignment: .topLeading)
61 .offset(CGSize(width: w(stages[0]), height: mapSize.height + padding))
65 .foregroundColor(color)
66 .frame(width: w(stages[2]) - w(stages[1]), height: stageHeight, alignment: .topLeading)
67 .offset(CGSize(width: w(stages[1]), height: mapSize.height + padding))
71 .foregroundColor(color)
72 .frame(width: mapSize.width - w(stages[2]), height: stageHeight, alignment: .topLeading)
73 .offset(CGSize(width: w(stages[2]), height: mapSize.height + padding))
77 func w(_ dimension: CGFloat) -> CGFloat {
78 max(0.0, min(mapSize.width, dimension * mapSize.width / 100.0))
82 struct MapAxes_Previews: PreviewProvider {
83 static var previews: some View {
85 mapSize: CGSize(width: 200.0, height: 200.0), lineWidth: CGFloat(1.0),
86 evolution: Stage.stages(.general), stages: [25.0, 50.0, 75.0]