diff options
author | Jason Wray <jason@mapbox.com> | 2016-10-07 15:14:19 -0400 |
---|---|---|
committer | Jason Wray <friedbunny@users.noreply.github.com> | 2016-10-11 13:07:10 -0400 |
commit | 5d85dbd7cd91e66ca791c6e6f73774f4f1323a87 (patch) | |
tree | 6e6e1254069b2b39e867934972df4a4ee9c0bb44 | |
parent | 9946e605365f8d4a718dfd85b4e28ca653a787c1 (diff) | |
download | qtlocation-mapboxgl-5d85dbd7cd91e66ca791c6e6f73774f4f1323a87.tar.gz |
[ios, macos] Add -mapView:didFinishLoadingStyle: delegate method
-rw-r--r-- | platform/ios/CHANGELOG.md | 1 | ||||
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 8 | ||||
-rw-r--r-- | platform/ios/src/MGLMapViewDelegate.h | 17 | ||||
-rw-r--r-- | platform/macos/CHANGELOG.md | 1 | ||||
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 8 | ||||
-rw-r--r-- | platform/macos/src/MGLMapViewDelegate.h | 17 |
6 files changed, 52 insertions, 0 deletions
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 07f0a3c89d..98d12b723d 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -25,6 +25,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * The `circle-pitch-scale` property is now supported in stylesheets, allowing circle features in a tilted base map to scale or remain the same size as the viewing distance changes. ([#5576](https://github.com/mapbox/mapbox-gl-native/pull/5576)) * The `identifier` property of an MGLFeature may now be either a number or string. ([#5514](https://github.com/mapbox/mapbox-gl-native/pull/5514)) * If MGLMapView is unable to obtain or parse a style, it now calls its delegate’s `-mapViewDidFailLoadingMap:withError:` method. ([#6145](https://github.com/mapbox/mapbox-gl-native/pull/6145)) +* Added the `-[MGLMapViewDelegate mapView:didFinishLoadingStyle:]` delegate method, which offers the earliest opportunity to modify the layout or appearance of the current style before the map view is displayed to the user. ([#6636](https://github.com/mapbox/mapbox-gl-native/pull/6636)) * Fixed crashes that could occur when loading a malformed stylesheet. ([#5736](https://github.com/mapbox/mapbox-gl-native/pull/5736)) * Fixed an issue causing stepwise zoom functions to be misinterpreted. ([#6328](https://github.com/mapbox/mapbox-gl-native/pull/6328)) * A source’s tiles are no longer rendered when the map is outside the source’s supported zoom levels. ([#6345](https://github.com/mapbox/mapbox-gl-native/pull/6345)) diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index fd3725ecd2..8b58fbaf65 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -4566,6 +4566,14 @@ public: } break; } + case mbgl::MapChangeDidFinishLoadingStyle: + { + if ([self.delegate respondsToSelector:@selector(mapView:didFinishLoadingStyle:)]) + { + [self.delegate mapView:self didFinishLoadingStyle:self.style]; + } + break; + } } } diff --git a/platform/ios/src/MGLMapViewDelegate.h b/platform/ios/src/MGLMapViewDelegate.h index ea9933f870..c07c43d3e4 100644 --- a/platform/ios/src/MGLMapViewDelegate.h +++ b/platform/ios/src/MGLMapViewDelegate.h @@ -126,6 +126,23 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)mapViewDidFinishRenderingFrame:(MGLMapView *)mapView fullyRendered:(BOOL)fullyRendered; +/** + Tells the delegate that the map has just finished loading a style. + + This method is called during the initialization of the map view and after any + subsequent loading of a new style. This method is called between the + `-mapViewWillStartRenderingMap:` and `-mapViewDidFinishRenderingMap:` delegate + methods. Changes to sources or layers of the current style do not cause this + method to be called. + + This method is the earliest opportunity to modify the layout or appearance of + the current style before the map view is displayed to the user. + + @param mapView The map view that has just loaded a style. + @param style The style that was loaded. + */ +- (void)mapView:(MGLMapView *)mapView didFinishLoadingStyle:(MGLStyle *)style; + #pragma mark Tracking User Location /** diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index e23d0199e9..9e5b861e82 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -20,6 +20,7 @@ * Fixed an issue causing an MGLOfflinePack’s progress to continue to update after calling `-suspend`. ([#6186](https://github.com/mapbox/mapbox-gl-native/pull/6186)) * Fixed an issue preventing cached annotation images from displaying while the device is offline. ([#6358](https://github.com/mapbox/mapbox-gl-native/pull/6358)) * If MGLMapView is unable to obtain or parse a style, it now calls its delegate’s `-mapViewDidFailLoadingMap:withError:` method. ([#6145](https://github.com/mapbox/mapbox-gl-native/pull/6145)) +* Added the `-[MGLMapViewDelegate mapView:didFinishLoadingStyle:]` delegate method, which offers the earliest opportunity to modify the layout or appearance of the current style before the map view is displayed to the user. ([#6636](https://github.com/mapbox/mapbox-gl-native/pull/6636)) * Fixed an issue causing stepwise zoom functions to be misinterpreted. ([#6328](https://github.com/mapbox/mapbox-gl-native/pull/6328)) * A source’s tiles are no longer rendered when the map is outside the source’s supported zoom levels. ([#6345](https://github.com/mapbox/mapbox-gl-native/pull/6345)) * Fixed a crash that could occur when the device is disconnected while downloading an offline pack. ([#6293](https://github.com/mapbox/mapbox-gl-native/pull/6293)) diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index d61b336c9f..96f49b7ca8 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -873,6 +873,14 @@ public: } break; } + case mbgl::MapChangeDidFinishLoadingStyle: + { + if ([self.delegate respondsToSelector:@selector(mapView:didFinishLoadingStyle:)]) + { + [self.delegate mapView:self didFinishLoadingStyle:self.style]; + } + break; + } } } diff --git a/platform/macos/src/MGLMapViewDelegate.h b/platform/macos/src/MGLMapViewDelegate.h index 8f4922d304..c946624f11 100644 --- a/platform/macos/src/MGLMapViewDelegate.h +++ b/platform/macos/src/MGLMapViewDelegate.h @@ -125,6 +125,23 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)mapViewDidFinishRenderingFrame:(MGLMapView *)mapView fullyRendered:(BOOL)fullyRendered; +/** + Tells the delegate that the map has just finished loading a style. + + This method is called during the initialization of the map view and after any + subsequent loading of a new style. This method is called between the + `-mapViewWillStartRenderingMap:` and `-mapViewDidFinishRenderingMap:` delegate + methods. Changes to sources or layers of the current style do not cause this + method to be called. + + This method is the earliest opportunity to modify the layout or appearance of + the current style before the map view is displayed to the user. + + @param mapView The map view that has just loaded a style. + @param style The style that was loaded. + */ +- (void)mapView:(MGLMapView *)mapView didFinishLoadingStyle:(MGLStyle *)style; + #pragma mark Managing the Appearance of Annotations /** |