diff options
Diffstat (limited to 'Map/Presentation/Complex Components/MapRender')
| -rw-r--r-- | Map/Presentation/Complex Components/MapRender/MapRenderView.swift | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Map/Presentation/Complex Components/MapRender/MapRenderView.swift b/Map/Presentation/Complex Components/MapRender/MapRenderView.swift index 896fbd0..9e1f4a2 100644 --- a/Map/Presentation/Complex Components/MapRender/MapRenderView.swift +++ b/Map/Presentation/Complex Components/MapRender/MapRenderView.swift @@ -41,16 +41,15 @@ struct MapRenderView: View { var onDragVertex: (Vertex, CGFloat, CGFloat) -> Void = { _, _, _ in } private func parseMapInBackground() { + parseTask?.cancel() let currentText = document.text parseTask = Task { - // Parse on background thread let parsed = await Task.detached(priority: .userInitiated) { MapParser.parse(content: currentText) }.value - // Calculate smart positions on background thread let positions = await Task.detached(priority: .userInitiated) { var positions: [Int: CGPoint] = [:] @@ -78,7 +77,6 @@ struct MapRenderView: View { return positions }.value - // Update UI on main thread if !Task.isCancelled { await MainActor.run { parsedMap = parsed |