aboutsummaryrefslogtreecommitdiff
path: root/Map/Views/MapRender.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Map/Views/MapRender.swift')
-rw-r--r--Map/Views/MapRender.swift11
1 files changed, 6 insertions, 5 deletions
diff --git a/Map/Views/MapRender.swift b/Map/Views/MapRender.swift
index b35b724..7623b61 100644
--- a/Map/Views/MapRender.swift
+++ b/Map/Views/MapRender.swift
@@ -5,6 +5,7 @@
// Created by Ruben Beltran del Rio on 2/1/21.
//
+import Combine
import CoreData
import CoreGraphics
import SwiftUI
@@ -13,7 +14,7 @@ struct MapRenderView: View {
@Environment(\.colorScheme) var colorScheme
- @ObservedObject var map: Map
+ var content: String
let evolution: Stage
let mapSize = CGSize(width: 1300.0, height: 1000.0)
@@ -23,7 +24,7 @@ struct MapRenderView: View {
let padding = CGFloat(30.0)
var parsedMap: ParsedMap {
- return map.parse()
+ return Map.parse(content: content)
}
var body: some View {
@@ -33,7 +34,7 @@ struct MapRenderView: View {
path.addRect(
CGRect(
x: -padding, y: -padding, width: mapSize.width + padding * 2,
- height: mapSize.height + padding * 2))
+ height: mapSize.height + padding * 4))
}.fill(MapColor.colorForScheme(colorScheme).background)
MapStages(mapSize: mapSize, lineWidth: lineWidth, stages: parsedMap.stages)
@@ -48,14 +49,14 @@ struct MapRenderView: View {
mapSize: mapSize, lineWidth: lineWidth, vertexSize: vertexSize, edges: parsedMap.edges)
}.frame(
width: mapSize.width,
- height: mapSize.height, alignment: .topLeading
+ height: mapSize.height + 2 * padding, alignment: .topLeading
).padding(padding)
}
}
struct MapRenderView_Previews: PreviewProvider {
static var previews: some View {
- MapDetailView(map: Map()).environment(
+ MapRenderView(content: "", evolution: Stage.stages(.general)).environment(
\.managedObjectContext, PersistenceController.preview.container.viewContext)
}
}