diff options
| author | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-12-14 20:21:24 +0100 |
|---|---|---|
| committer | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-12-15 00:10:39 +0100 |
| commit | 0d5e6636405dbe332c33c0fb82c7ccccb20f96cb (patch) | |
| tree | a9cda2b711bbfc9277d66310440dd965b16682fc /Map/Presentation/Base Components/MapRender | |
| parent | a5ae7aedc840a38505b3181f4e5ba92e90d94fa1 (diff) | |
Use wmap-parser-swift and tree-sitter-wmap for parsing and highlighting.
Diffstat (limited to 'Map/Presentation/Base Components/MapRender')
8 files changed, 13 insertions, 15 deletions
diff --git a/Map/Presentation/Base Components/MapRender/MapAxes.swift b/Map/Presentation/Base Components/MapRender/MapAxes.swift index 9d0f43f..7c2b74b 100644 --- a/Map/Presentation/Base Components/MapRender/MapAxes.swift +++ b/Map/Presentation/Base Components/MapRender/MapAxes.swift @@ -19,7 +19,7 @@ struct MapAxes: View { let mapSize: CGSize let lineWidth: CGFloat let evolution: Stage - let stages: [CGFloat] + let stages: [Double] let stageHeight = CGFloat(100.0) let padding = CGFloat(5.0) diff --git a/Map/Presentation/Base Components/MapRender/MapBackground.swift b/Map/Presentation/Base Components/MapRender/MapBackground.swift index b33e791..710d549 100644 --- a/Map/Presentation/Base Components/MapRender/MapBackground.swift +++ b/Map/Presentation/Base Components/MapRender/MapBackground.swift @@ -14,14 +14,13 @@ // along with this program. If not, see https://map.tranquil.systems. import Patterns import SwiftUI +import WmapParser struct MapBackground: View { let mapSize: CGSize - let lineWidth: CGFloat - let stages: [CGFloat] - let opacity = 0.1 - + let stages: [Double] + var body: some View { ZStack(alignment: .topLeading) { PatternView( @@ -57,6 +56,6 @@ struct MapBackground: View { #Preview { MapBackground( - mapSize: CGSize(width: 200.0, height: 200.0), lineWidth: CGFloat(0.5), - stages: [25.0, 50.0, 75.0]) + mapSize: CGSize(width: 200.0, height: 200.0), + stages: []) } diff --git a/Map/Presentation/Base Components/MapRender/MapEdges.swift b/Map/Presentation/Base Components/MapRender/MapEdges.swift index 3c6ef82..5819069 100644 --- a/Map/Presentation/Base Components/MapRender/MapEdges.swift +++ b/Map/Presentation/Base Components/MapRender/MapEdges.swift @@ -13,6 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see https://map.tranquil.systems. import SwiftUI +import WmapParser struct MapEdges: View { diff --git a/Map/Presentation/Base Components/MapRender/MapGroup.swift b/Map/Presentation/Base Components/MapRender/MapGroup.swift index a5877a8..ca5e954 100644 --- a/Map/Presentation/Base Components/MapRender/MapGroup.swift +++ b/Map/Presentation/Base Components/MapRender/MapGroup.swift @@ -22,7 +22,6 @@ struct MapGroup: View { let group: [Vertex] let color: Color - let cornerSize = CGSize(width: 2.0, height: 2.0) var strokeSize: CGFloat { 1.75 * vertexSize.width } var hull: [CGPoint] { @@ -92,6 +91,6 @@ struct MapGroup: View { Vertex(id: 0, label: "A Circle", position: CGPoint(x: 50.0, y: 50.0)), Vertex(id: 1, label: "A Square", position: CGPoint(x: 10.0, y: 20.0), shape: .square), Vertex(id: 2, label: "A triangle", position: CGPoint(x: 25, y: 32.0), shape: .triangle), - Vertex(id: 3, label: "An X", position: CGPoint(x: 70.0, y: 70.0), shape: .x), + Vertex(id: 3, label: "An X", position: CGPoint(x: 70.0, y: 70.0), shape: .xMark), ], color: .red) } diff --git a/Map/Presentation/Base Components/MapRender/MapGroups.swift b/Map/Presentation/Base Components/MapRender/MapGroups.swift index 1983dcd..149ea65 100644 --- a/Map/Presentation/Base Components/MapRender/MapGroups.swift +++ b/Map/Presentation/Base Components/MapRender/MapGroups.swift @@ -40,7 +40,7 @@ struct MapGroups: View { Vertex(id: 0, label: "A Circle", position: CGPoint(x: 50.0, y: 50.0)), Vertex(id: 1, label: "A Square", position: CGPoint(x: 10.0, y: 20.0), shape: .square), Vertex(id: 2, label: "A triangle", position: CGPoint(x: 25, y: 32.0), shape: .triangle), - Vertex(id: 3, label: "An X", position: CGPoint(x: 70.0, y: 70.0), shape: .x), + Vertex(id: 3, label: "An X", position: CGPoint(x: 70.0, y: 70.0), shape: .xMark), ] ]) } diff --git a/Map/Presentation/Base Components/MapRender/MapMask.swift b/Map/Presentation/Base Components/MapRender/MapMask.swift index b477c0a..c4ba055 100644 --- a/Map/Presentation/Base Components/MapRender/MapMask.swift +++ b/Map/Presentation/Base Components/MapRender/MapMask.swift @@ -65,7 +65,7 @@ struct MapMask: View { Vertex(id: 0, label: "A Circle", position: CGPoint(x: 50.0, y: 50.0)), Vertex(id: 1, label: "A Square", position: CGPoint(x: 10.0, y: 20.0), shape: .square), Vertex(id: 2, label: "A triangle", position: CGPoint(x: 25, y: 32.0), shape: .triangle), - Vertex(id: 3, label: "An X", position: CGPoint(x: 70.0, y: 70.0), shape: .x), + Vertex(id: 3, label: "An X", position: CGPoint(x: 70.0, y: 70.0), shape: .xMark), ], labelPositions: [:]) } diff --git a/Map/Presentation/Base Components/MapRender/MapStages.swift b/Map/Presentation/Base Components/MapRender/MapStages.swift index 7d7e51e..bcd95a2 100644 --- a/Map/Presentation/Base Components/MapRender/MapStages.swift +++ b/Map/Presentation/Base Components/MapRender/MapStages.swift @@ -19,8 +19,7 @@ struct MapStages: View { let mapSize: CGSize let lineWidth: CGFloat - let stages: [CGFloat] - let opacity = 0.1 + let stages: [Double] var body: some View { ZStack(alignment: .topLeading) { diff --git a/Map/Presentation/Base Components/MapRender/MapVertices.swift b/Map/Presentation/Base Components/MapRender/MapVertices.swift index 621c2f9..a3558fa 100644 --- a/Map/Presentation/Base Components/MapRender/MapVertices.swift +++ b/Map/Presentation/Base Components/MapRender/MapVertices.swift @@ -132,7 +132,7 @@ struct MapVertices: View { to: CGPoint(x: w(vertex.position.x), y: h(vertex.position.y) + vertexSize.height)) path.closeSubpath() } - case .x: + case .xMark: return Path { path in path.move(to: CGPoint(x: w(vertex.position.x), y: h(vertex.position.y))) path.addLine( @@ -156,7 +156,7 @@ struct MapVertices: View { Vertex(id: 0, label: "A Circle", position: CGPoint(x: 50.0, y: 50.0)), Vertex(id: 1, label: "A Square", position: CGPoint(x: 10.0, y: 20.0), shape: .square), Vertex(id: 2, label: "A triangle", position: CGPoint(x: 25, y: 32.0), shape: .triangle), - Vertex(id: 3, label: "An X", position: CGPoint(x: 70.0, y: 70.0), shape: .x), + Vertex(id: 3, label: "An X", position: CGPoint(x: 70.0, y: 70.0), shape: .xMark), ], labelPositions: [:]) } |