aboutsummaryrefslogtreecommitdiff
path: root/Map/MapRenderComponents/MapAxes.swift
diff options
context:
space:
mode:
authorRuben Beltran del Rio <ruben@unlimited.pizza>2023-05-07 15:22:54 +0200
committerRuben Beltran del Rio <ruben@unlimited.pizza>2023-05-07 15:22:54 +0200
commitfdb4633d3e9158e457d57e820df6e1efb4df39c2 (patch)
tree176cad99cb9befc0a65a7af02561019e811814de /Map/MapRenderComponents/MapAxes.swift
parent75a0e4509a70055851b085f3f7293ae1cf48164c (diff)
Update to support notes + new style2.0.0
Diffstat (limited to 'Map/MapRenderComponents/MapAxes.swift')
-rw-r--r--Map/MapRenderComponents/MapAxes.swift89
1 files changed, 0 insertions, 89 deletions
diff --git a/Map/MapRenderComponents/MapAxes.swift b/Map/MapRenderComponents/MapAxes.swift
deleted file mode 100644
index a6e2f87..0000000
--- a/Map/MapRenderComponents/MapAxes.swift
+++ /dev/null
@@ -1,89 +0,0 @@
-import SwiftUI
-
-struct MapAxes: View {
-
- @Environment(\.colorScheme) var colorScheme
-
- let mapSize: CGSize
- let lineWidth: CGFloat
- let evolution: Stage
- let stages: [CGFloat]
- let stageHeight = CGFloat(100.0)
- let padding = CGFloat(5.0)
-
- var color: Color {
- MapColor.colorForScheme(colorScheme).foreground
- }
-
- var body: some View {
- ZStack(alignment: .topLeading) {
-
- // Axis Lines
- Path { path in
- path.move(to: CGPoint(x: 0, y: 0))
- path.addLine(to: CGPoint(x: 0, y: mapSize.height))
- path.addLine(to: CGPoint(x: mapSize.width, y: mapSize.height))
- path.move(to: CGPoint(x: mapSize.width, y: mapSize.height))
- path.closeSubpath()
- }.stroke(color, lineWidth: lineWidth * 2)
-
- // Y Labels
- Text("Visible").font(.title3).foregroundColor(color).rotationEffect(Angle(degrees: -90.0))
- .offset(CGSize(width: -35.0, height: 0.0))
- Text("Value Chain").font(.title).foregroundColor(color).rotationEffect(Angle(degrees: -90.0))
- .offset(CGSize(width: -72.0, height: mapSize.height / 2 - 20))
- Text("Invisible").font(.title3).foregroundColor(color).rotationEffect(Angle(degrees: -90.0))
- .offset(CGSize(width: -40.0, height: mapSize.height - 20))
-
- // X Labels
-
- Text("Uncharted")
- .font(.title3)
- .foregroundColor(color)
- .frame(width: mapSize.width / 4, height: stageHeight / 2.0, alignment: .topLeading)
- .offset(CGSize(width: 0.0, height: -stageHeight / 4.0))
- Text("Industrialised")
- .font(.title3)
- .foregroundColor(color)
- .frame(width: mapSize.width / 4, height: stageHeight / 2.0, alignment: .topLeading)
- .offset(CGSize(width: mapSize.width - 100.0, height: -stageHeight / 4.0))
-
- Text(evolution.i)
- .font(.title3)
- .foregroundColor(color)
- .frame(width: w(stages[0]), height: stageHeight, alignment: .topLeading)
- .offset(CGSize(width: 0.0, height: mapSize.height + padding))
-
- Text(evolution.ii)
- .font(.title3)
- .foregroundColor(color)
- .frame(width: w(stages[1]) - w(stages[0]), height: stageHeight, alignment: .topLeading)
- .offset(CGSize(width: w(stages[0]), height: mapSize.height + padding))
-
- Text(evolution.iii)
- .font(.title3)
- .foregroundColor(color)
- .frame(width: w(stages[2]) - w(stages[1]), height: stageHeight, alignment: .topLeading)
- .offset(CGSize(width: w(stages[1]), height: mapSize.height + padding))
-
- Text(evolution.iv)
- .font(.title3)
- .foregroundColor(color)
- .frame(width: mapSize.width - w(stages[2]), height: stageHeight, alignment: .topLeading)
- .offset(CGSize(width: w(stages[2]), height: mapSize.height + padding))
- }
- }
-
- func w(_ dimension: CGFloat) -> CGFloat {
- max(0.0, min(mapSize.width, dimension * mapSize.width / 100.0))
- }
-}
-
-struct MapAxes_Previews: PreviewProvider {
- static var previews: some View {
- MapAxes(
- mapSize: CGSize(width: 200.0, height: 200.0), lineWidth: CGFloat(1.0),
- evolution: Stage.stages(.general), stages: [25.0, 50.0, 75.0]
- ).padding(50.0)
- }
-}