5 // Created by Ruben Beltran del Rio on 2/1/21.
13 struct MapRenderView: View {
15 @Environment(\.colorScheme) var colorScheme
20 let mapSize = CGSize(width: 1300.0, height: 1000.0)
22 let lineWidth = CGFloat(1.0)
23 let vertexSize = CGSize(width: 25.0, height: 25.0)
24 let padding = CGFloat(30.0)
26 var parsedMap: ParsedMap {
27 return Map.parse(content: content)
31 ZStack(alignment: .topLeading) {
36 x: -padding, y: -padding, width: mapSize.width + padding * 2,
37 height: mapSize.height + padding * 4))
38 }.fill(MapColor.colorForScheme(colorScheme).background)
40 MapStages(mapSize: mapSize, lineWidth: lineWidth, stages: parsedMap.stages)
42 mapSize: mapSize, lineWidth: lineWidth, evolution: evolution, stages: parsedMap.stages)
44 mapSize: mapSize, lineWidth: lineWidth, vertexSize: vertexSize,
45 opportunities: parsedMap.opportunities)
46 MapBlockers(mapSize: mapSize, vertexSize: vertexSize, blockers: parsedMap.blockers)
47 MapVertices(mapSize: mapSize, vertexSize: vertexSize, vertices: parsedMap.vertices)
49 mapSize: mapSize, lineWidth: lineWidth, vertexSize: vertexSize, edges: parsedMap.edges)
52 height: mapSize.height + 2 * padding, alignment: .topLeading
57 struct MapRenderView_Previews: PreviewProvider {
58 static var previews: some View {
59 MapRenderView(content: "", evolution: Stage.stages(.general)).environment(
60 \.managedObjectContext, PersistenceController.preview.container.viewContext)