@@ -139,7 +139,7 @@ struct CustomMap: UIViewRepresentable {
139139
140140 let shadowOverlay : ShadowOverlay
141141
142- private let maxZoomAltitude : CLLocationDistance = 100
142+ private let maxZoomAltitude : CLLocationDistance = 120
143143 private var zoomReachedLimit : Bool = false
144144
145145 init ( _ parent: CustomMap , shadowOverlay: ShadowOverlay ) {
@@ -274,6 +274,9 @@ struct CustomMap: UIViewRepresentable {
274274 mapView. showAnnotations ( annotation. memberAnnotations, animated: true )
275275
276276 if zoomReachedLimit && annotation. memberAnnotations. count <= 3 {
277+ let firstAnnotation = annotation. memberAnnotations. first as! DisplayUnitAnnotation
278+ let secondAnnotation = annotation. memberAnnotations. last as! DisplayUnitAnnotation
279+
277280 if let annotation = annotation. memberAnnotations. first as? DisplayUnitAnnotation {
278281 selectedAnAnnotation ( selectedQuest: annotation)
279282 }
@@ -350,12 +353,7 @@ struct CustomMap: UIViewRepresentable {
350353 }
351354
352355 func mapView( _ mapView: MKMapView , regionDidChangeAnimated animated: Bool ) {
353- let currentAltitude = mapView. camera. altitude
354- if currentAltitude < maxZoomAltitude {
355- zoomReachedLimit = true
356- } else {
357- zoomReachedLimit = false
358- }
356+ zoomReachedLimit = mapView. isZoomedIn ( )
359357 }
360358
361359 private func selectedAnAnnotation( selectedQuest: DisplayUnitAnnotation ) {
0 commit comments