diff options
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 { |