X-Git-Url: https://git.r.bdr.sh/rbdr/map/blobdiff_plain/5e8ff4850c4827125fe12788dd5b153c4f636f48..144167621e845b05df55a9f2f00c4bc270d42b55:/Map/Views/MapRender.swift?ds=sidebyside 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) } }