diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-07-08 09:54:42 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-07-08 09:54:42 +0200 |
| commit | 52f84748e76f602c0cac8175f7d3cf3e76a5b31b (patch) | |
| tree | 6a4e3eca363e08aa73705f59e28c0d7cf30779b6 /Map/Presentation/Complex Components/MapRender/MapRenderView.swift | |
| parent | 96185dcaa7e2a0f475e6519a94f53a90920af93f (diff) | |
Formatting
Diffstat (limited to 'Map/Presentation/Complex Components/MapRender/MapRenderView.swift')
| -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 |