diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-07-08 21:21:08 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-07-08 21:21:08 +0200 |
| commit | c21a68c807dcb84b4ce910ee0f73238a8019ffe9 (patch) | |
| tree | ae1e5e0fc7a846daf74623c6cd6270612ff0e56f /Map/Presentation/Complex Components/MapRender/MapRenderView.swift | |
| parent | 8f6da65a680cdd30ec541b3b226137004a1e4681 (diff) | |
Allow export/import of preferences
Diffstat (limited to 'Map/Presentation/Complex Components/MapRender/MapRenderView.swift')
| -rw-r--r-- | Map/Presentation/Complex Components/MapRender/MapRenderView.swift | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Map/Presentation/Complex Components/MapRender/MapRenderView.swift b/Map/Presentation/Complex Components/MapRender/MapRenderView.swift index 9e1f4a2..72a765d 100644 --- a/Map/Presentation/Complex Components/MapRender/MapRenderView.swift +++ b/Map/Presentation/Complex Components/MapRender/MapRenderView.swift @@ -21,9 +21,13 @@ struct MapRenderView: View { @Binding var document: MapDocument @Binding var evolution: StageType - @AppStorage("showMapBackground") var showMapBackground: Bool = true - @AppStorage("useCustomFont") var useCustomFont: Bool = false - @AppStorage("customFontName") var customFontName: String = "Helvetica" + @AppStorage("showMapBackground") var showMapBackground: Bool = UserPreferences.Defaults + .showMapBackground + @AppStorage("useCustomFont") var useCustomFont: Bool = UserPreferences.Defaults.useCustomFont + @AppStorage("customFontName") var customFontName: String = UserPreferences.Defaults.customFontName + @AppStorage("useSmartLabelPositioning") private var useSmartLabelPositioning = UserPreferences + .Defaults.useSmartLabelPositioning + var stage: Stage { Stage.stages(evolution) } @@ -53,6 +57,8 @@ struct MapRenderView: View { let positions = await Task.detached(priority: .userInitiated) { var positions: [Int: CGPoint] = [:] + guard await useSmartLabelPositioning else { return positions } + let axisLines = [ Line(start: CGPoint(x: 0, y: 0), end: CGPoint(x: 0, y: mapSize.height)), Line( @@ -133,7 +139,10 @@ struct MapRenderView: View { .onAppear { parseMapInBackground() } - .onChange(of: document.text) { _, _ in + .onChange(of: document.text) { + parseMapInBackground() + } + .onChange(of: useSmartLabelPositioning) { parseMapInBackground() } .onDisappear { |