5 // Created by Ruben Beltran del Rio on 2/1/21.
12 struct MapRenderView: View {
14 @Environment(\.colorScheme) var colorScheme
16 @ObservedObject var map: Map
19 let mapSize = CGSize(width: 1300.0, height: 1000.0)
21 let lineWidth = CGFloat(1.0)
22 let vertexSize = CGSize(width: 25.0, height: 25.0)
23 let padding = CGFloat(30.0)
25 var parsedMap: ParsedMap {
30 ZStack(alignment: .topLeading) {
35 x: -padding, y: -padding, width: mapSize.width + padding * 2,
36 height: mapSize.height + padding * 2))
37 }.fill(MapColor.colorForScheme(colorScheme).background)
39 MapStages(mapSize: mapSize, lineWidth: lineWidth, stages: parsedMap.stages)
41 mapSize: mapSize, lineWidth: lineWidth, evolution: evolution, stages: parsedMap.stages)
43 mapSize: mapSize, lineWidth: lineWidth, vertexSize: vertexSize,
44 opportunities: parsedMap.opportunities)
45 MapBlockers(mapSize: mapSize, vertexSize: vertexSize, blockers: parsedMap.blockers)
46 MapVertices(mapSize: mapSize, vertexSize: vertexSize, vertices: parsedMap.vertices)
48 mapSize: mapSize, lineWidth: lineWidth, vertexSize: vertexSize, edges: parsedMap.edges)
51 height: mapSize.height, alignment: .topLeading
56 struct MapRenderView_Previews: PreviewProvider {
57 static var previews: some View {
58 MapDetailView(map: Map()).environment(
59 \.managedObjectContext, PersistenceController.preview.container.viewContext)