@@ -32,23 +32,17 @@ struct OnDemandConfigurationView: View {
3232 /// The max scale of the map to take offline.
3333 @State private var maxScale : CacheScale = . street
3434
35- /// The visible area of the map.
36- @State private var visibleArea : Envelope ?
37-
3835 /// The selected map area.
3936 @State private var selectedRect : CGRect = . zero
4037
41- /// The extent of the selected map area.
42- @State private var selectedExtent : Envelope ?
43-
4438 /// A Boolean value indicating that the map is ready.
4539 @State private var mapIsReady = false
4640
4741 /// The action to dismiss the view.
4842 @Environment ( \. dismiss) private var dismiss
4943
5044 /// A Boolean value indicating if the download button is disabled.
51- private var downloadIsDisabled : Bool { selectedExtent == nil || hasNoInternetConnection }
45+ private var downloadIsDisabled : Bool { selectedRect == . zero || hasNoInternetConnection }
5246
5347 /// The result of trying to load the map.
5448 @State private var loadResult : Result < Void , Error > ?
@@ -122,9 +116,6 @@ struct OnDemandConfigurationView: View {
122116 OnDemandMapAreaSelectorView ( selectedRect: $selectedRect)
123117 }
124118 }
125- . onChange ( selectedRect) { _ in
126- selectedExtent = mapViewProxy. envelope ( fromViewRect: selectedRect)
127- }
128119 }
129120 . safeAreaInset ( edge: . bottom) {
130121 bottomPane ( mapView: mapViewProxy)
@@ -209,7 +200,7 @@ struct OnDemandConfigurationView: View {
209200
210201 HStack {
211202 Button {
212- guard let selectedExtent else { return }
203+ guard let selectedExtent = mapView . envelope ( fromViewRect : selectedRect ) else { return }
213204 Task {
214205 let image = try ? await mapView. exportImage ( )
215206 let thumbnail = image? . crop ( to: selectedRect)
0 commit comments