diff options
Diffstat (limited to 'Map/MapApp.swift')
| -rw-r--r-- | Map/MapApp.swift | 45 |
1 files changed, 1 insertions, 44 deletions
diff --git a/Map/MapApp.swift b/Map/MapApp.swift index b66d715..5e74049 100644 --- a/Map/MapApp.swift +++ b/Map/MapApp.swift @@ -32,7 +32,7 @@ struct MapApp: App { var body: some Scene { DocumentGroup(newDocument: MapDocument(text: nil)) { file in - MapEditor(document: file.$document, url: file.fileURL) + MapEditor(document: file.$document) .focusedSceneValue(\.document, file.$document) .focusedSceneValue(\.fileURL, file.fileURL) } @@ -65,46 +65,3 @@ struct MapApp: App { } } } - -struct LazyMapEditor: View { - @Binding var document: MapDocument - var url: URL? - - @FocusedBinding(\.document) var focusedDocument: MapDocument? - @FocusedValue(\.fileURL) var focusedFileURL: URL? - @State private var shouldRender = false - @State private var renderTask: Task<Void, Never>? - - var isActiveDocument: Bool { - guard let focusedDocument else { return false } - // Use URL for identification if available, otherwise fall back to text comparison - if let documentURL = url, - let focusedURL = focusedFileURL - { - return documentURL == focusedURL - } - // For new documents without URLs, use text comparison as fallback - return focusedDocument.text == document.text - } - - var body: some View { - if isActiveDocument { - MapEditor(document: $document, url: url) - } else { - Rectangle() - .fill(Color(NSColor.windowBackgroundColor)) - .overlay( - VStack(spacing: 16) { - Text("document.inactive") - .font(.title2) - .foregroundColor(.secondary) - if let url = url { - Text(url.lastPathComponent) - .font(.caption) - .foregroundColor(.secondary) - } - } - ) - } - } -} |