diff --git a/.gitmodules b/.gitmodules index 920fa338a..fc2786757 100644 --- a/.gitmodules +++ b/.gitmodules @@ -57,7 +57,7 @@ url = https://github.com/protomaps/PMTiles.git [submodule "vendor/maplibre-native-base/extras/args"] path = vendor/maplibre-native-base/extras/args - url = https://github.com/Taywee/args + url = https://github.com/Taywee/args.git [submodule "vendor/maplibre-native-base/extras/expected-lite"] path = vendor/maplibre-native-base/extras/expected-lite url = https://github.com/martinmoene/expected-lite.git diff --git a/platform/ios/app/MBXViewController.mm b/platform/ios/app/MBXViewController.mm index 71c000480..21aad9900 100644 --- a/platform/ios/app/MBXViewController.mm +++ b/platform/ios/app/MBXViewController.mm @@ -2264,6 +2264,11 @@ CLLocationCoordinate2D randomWorldCoordinate(void) { // MARK: - MLNMapViewDelegate +- (void)mapView:(MLNMapView *)mapView sourceDidChange:(MLNSource *)source +{ + NSLog(@"A source was updated: %@", source.identifier); +} + - (void)mapView:(MLNMapView *)mapView shaderWillCompile:(NSInteger)id backend:(NSInteger)backend diff --git a/platform/ios/src/MLNMapView.mm b/platform/ios/src/MLNMapView.mm index da42ab8b8..29c325339 100644 --- a/platform/ios/src/MLNMapView.mm +++ b/platform/ios/src/MLNMapView.mm @@ -6933,8 +6933,13 @@ static void *windowScreenContext = &windowScreenContext; } - (void)sourceDidChange:(MLNSource *)source { - // no-op: we only show attribution after tapping the info button, so there's no - // interactive update needed. + if (!_mbglMap) { + return; + } + + if ([self.delegate respondsToSelector:@selector(mapView:sourceDidChange:)]) { + [self.delegate mapView:self sourceDidChange:source]; + } } - (void)didFailToLoadImage:(NSString *)imageName { diff --git a/platform/ios/src/MLNMapViewDelegate.h b/platform/ios/src/MLNMapViewDelegate.h index cae97926f..1fa78827a 100644 --- a/platform/ios/src/MLNMapViewDelegate.h +++ b/platform/ios/src/MLNMapViewDelegate.h @@ -302,6 +302,14 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)mapView:(MLNMapView *)mapView didFinishLoadingStyle:(MLNStyle *)style; +/** + Tells the delegate that the source changed. + + @param mapView The map view that owns the source. + @param source The source that changed. + */ +- (void)mapView:(MLNMapView *)mapView sourceDidChange:(MLNSource *)source; + /** Tells the delegate that the `mapView` is missing an image. The image should be added synchronously with ``MLNStyle/setImage:forName:`` to be rendered on the current zoom level. When loading icons diff --git a/platform/ios/test/MLNMapViewDelegateIntegrationTests.swift b/platform/ios/test/MLNMapViewDelegateIntegrationTests.swift index fcb33adef..3509830e1 100644 --- a/platform/ios/test/MLNMapViewDelegateIntegrationTests.swift +++ b/platform/ios/test/MLNMapViewDelegateIntegrationTests.swift @@ -30,6 +30,8 @@ extension MLNMapViewDelegateIntegrationTests: MLNMapViewDelegate { func mapView(_: MLNMapView, didFinishLoading _: MLNStyle) {} + func mapView(_: MLNMapView, sourceDidChange _: MLNSource) {} + func mapView(_: MLNMapView, didSelect _: MLNAnnotation) {} func mapView(_: MLNMapView, didDeselect _: MLNAnnotation) {} diff --git a/platform/macos/src/MLNMapView.mm b/platform/macos/src/MLNMapView.mm index 7a5281c9c..6ef3e8863 100644 --- a/platform/macos/src/MLNMapView.mm +++ b/platform/macos/src/MLNMapView.mm @@ -984,6 +984,11 @@ public: if (!_mbglMap) { return; } + + if ([self.delegate respondsToSelector:@selector(mapView:sourceDidChange:)]) { + [self.delegate mapView:self sourceDidChange:source]; + } + // Attribution only applies to tiled sources if ([source isKindOfClass:[MLNTileSource class]]) { [self installAttributionView]; diff --git a/platform/macos/src/MLNMapViewDelegate.h b/platform/macos/src/MLNMapViewDelegate.h index cd2b36ef4..07be47b8a 100644 --- a/platform/macos/src/MLNMapViewDelegate.h +++ b/platform/macos/src/MLNMapViewDelegate.h @@ -204,6 +204,14 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)mapView:(MLNMapView *)mapView didFinishLoadingStyle:(MLNStyle *)style; +/** + Tells the delegate that the source changed. + + @param mapView The map view that owns the source. + @param source The source that changed. + */ +- (void)mapView:(MLNMapView *)mapView sourceDidChange:(MLNSource *)source; + /** Tells the delegate that the `mapView` is missing an image. The image should be added synchronously with ``MLNStyle/setImage:forName:`` to be rendered on the current zoom level. When loading icons diff --git a/platform/macos/test/MLNMapViewDelegateIntegrationTests.swift b/platform/macos/test/MLNMapViewDelegateIntegrationTests.swift index a93a9ef9a..b69286f6a 100644 --- a/platform/macos/test/MLNMapViewDelegateIntegrationTests.swift +++ b/platform/macos/test/MLNMapViewDelegateIntegrationTests.swift @@ -38,6 +38,8 @@ extension MLNMapViewDelegateIntegrationTests: MLNMapViewDelegate { func mapView(_: MLNMapView, didFinishLoading _: MLNStyle) {} + func mapView(_: MLNMapView, sourceDidChange _: MLNSource) {} + func mapViewWillStartRenderingFrame(_: MLNMapView) {} func mapViewWillStartRenderingMap(_: MLNMapView) {}