File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -260,7 +260,7 @@ extension MapViewCoordinator: MLNMapViewDelegate {
260260 // FIXME: CI complains about MainActor.assumeIsolated being unavailable before iOS 17, despite building on iOS 17.2... This is an epic hack to fix it for now. I can only assume this is an issue with Xcode pre-15.3
261261 // TODO: We could put this in regionIsChangingWith if we calculate significant change/debounce.
262262 Task { @MainActor in
263- updateViewPort ( mapView: mapView)
263+ updateViewPort ( mapView: mapView, reason : reason )
264264 }
265265
266266 guard !suppressCameraUpdatePropagation else {
@@ -275,12 +275,14 @@ extension MapViewCoordinator: MLNMapViewDelegate {
275275
276276 // MARK: MapViewPort
277277
278- @MainActor private func updateViewPort( mapView: MLNMapView ) {
278+ @MainActor private func updateViewPort( mapView: MLNMapView , reason: MLNCameraChangeReason ) {
279+
279280 // Calculate the Raw "ViewPort"
280281 let calculatedViewPort = MapViewPort (
281282 center: mapView. centerCoordinate,
282283 zoom: mapView. zoomLevel,
283- direction: mapView. direction
284+ direction: mapView. direction,
285+ lastReasonForChange: CameraChangeReason ( reason)
284286 )
285287
286288 onViewPortChanged ( calculatedViewPort)
Original file line number Diff line number Diff line change @@ -15,17 +15,25 @@ public struct MapViewPort: Hashable, Equatable {
1515
1616 /// The current compass direction of the MapView
1717 public let direction : CLLocationDirection
18+
19+ /// The reason the view port was changed.
20+ public let lastReasonForChange : CameraChangeReason ?
1821
19- public init ( center: CLLocationCoordinate2D , zoom: Double , direction: CLLocationDirection ) {
22+ public init ( center: CLLocationCoordinate2D ,
23+ zoom: Double ,
24+ direction: CLLocationDirection ,
25+ lastReasonForChange: CameraChangeReason ? ) {
2026 self . center = center
2127 self . zoom = zoom
2228 self . direction = direction
29+ self . lastReasonForChange = lastReasonForChange
2330 }
2431
2532 public static func zero( zoom: Double = 10 ) -> MapViewPort {
2633 MapViewPort ( center: CLLocationCoordinate2D ( latitude: 0 , longitude: 0 ) ,
2734 zoom: zoom,
28- direction: 0 )
35+ direction: 0 ,
36+ lastReasonForChange: nil )
2937 }
3038}
3139
You can’t perform that action at this time.
0 commit comments