// Created by Ruben Beltran del Rio on 2/1/21.
//
+import Combine
import CoreData
import CoreGraphics
import SwiftUI
@Environment(\.colorScheme) var colorScheme
- @ObservedObject var map: Map
+ var content: String
let evolution: Stage
let mapSize = CGSize(width: 1300.0, height: 1000.0)
let padding = CGFloat(30.0)
var parsedMap: ParsedMap {
- return map.parse()
+ return Map.parse(content: content)
}
var body: some 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)
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)
}
}