@@ -58,7 +58,7 @@ struct RedWindowMapView: View {
5858 . mapColorScheme ( useNaturalColors ? . natural : . default)
5959 #if os(iOS)
6060 . allowsPencilKitDrawings( allowMapDrawings)
61- . activateDrawingCanvas ( isDrawing: $isDrawingOnMap)
61+ . activateDrawingCanvas ( isDrawing: $isDrawingOnMap, clearWhenDismissed : true )
6262 . addedMapDrawing ( storeDrawing ( _: ) )
6363 #endif
6464 }
@@ -148,40 +148,42 @@ struct RedWindowMapView: View {
148148 file. drawings. append ( storedDrawing)
149149 }
150150
151+ // NOTE(marquiskurt): Since this toolbar function is just a view provider, I've disabled the lint warning for now.
152+ // swiftlint:disable:next function_body_length
151153 private func toolbar( _ environment: RedWindowEnvironment ) -> some ToolbarContent {
152154 @Bindable var env = environment
153155 return Group {
154- ToolbarItem {
155- Menu ( " Map " , systemImage: " map " ) {
156- #if os(iOS)
157- Label ( " Map " , systemImage: " map " )
158- . foregroundStyle ( . secondary)
159- #endif
160- Divider ( )
161- Toggle ( isOn: $useNaturalColors) {
162- Label ( " Natural Colors " , systemImage: " paintpalette " )
156+ if !isDrawingOnMap {
157+ ToolbarItem {
158+ Menu ( " Map " , systemImage: " map " ) {
159+ #if os(iOS)
160+ Label ( " Map " , systemImage: " map " )
161+ . foregroundStyle ( . secondary)
162+ #endif
163+ Divider ( )
164+ Toggle ( isOn: $useNaturalColors) {
165+ Label ( " Natural Colors " , systemImage: " paintpalette " )
166+ }
167+ WorldDimensionPickerView ( selection: $env. currentDimension)
168+ . pickerStyle ( . inline)
169+ . labelsVisibility ( . visible)
163170 }
164- WorldDimensionPickerView ( selection: $env. currentDimension)
165- . pickerStyle ( . inline)
166- . labelsVisibility ( . visible)
167- }
168- }
169-
170- ToolbarSpacer ( . fixed)
171-
172- ToolbarItem {
173- Button ( " Go To " , systemImage: " figure.walk " ) {
174- displayWarpForm. toggle ( )
175171 }
176- }
177- #if os(iOS)
178- if allowMapDrawings, !isDrawingOnMap {
179- ToolbarSpacer ( . fixed)
172+ ToolbarSpacer ( . fixed)
173+ ToolbarItem {
174+ Button ( " Go To " , systemImage: " figure.walk " ) {
175+ displayWarpForm. toggle ( )
176+ }
180177 }
181- #endif
182- ToolbarItem {
183- Button ( " Pin Here... " , systemImage: " mappin.circle " ) {
184- displayPinForm. toggle ( )
178+ #if os(iOS)
179+ if allowMapDrawings {
180+ ToolbarSpacer ( . fixed)
181+ }
182+ #endif
183+ ToolbarItem {
184+ Button ( " Pin Here... " , systemImage: " mappin.circle " ) {
185+ displayPinForm. toggle ( )
186+ }
185187 }
186188 }
187189 #if os(iOS)
0 commit comments