summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorm-stephen <truestyle2005@163.com>2019-03-06 12:02:31 +0800
committerGitHub <noreply@github.com>2019-03-06 12:02:31 +0800
commit383fde6804b0865dce6aaf22394509722845c33f (patch)
treeb867449a2c90c8b42c99137ff3c967de1c2e9bc3
parent113179cddd76cf5ed325262b094fc3ea6bd2c201 (diff)
downloadqtlocation-mapboxgl-383fde6804b0865dce6aaf22394509722845c33f.tar.gz
Add option to prefetch low-resolution tiles (#14031)
* Add option to prefetch low-resolution tiles
-rw-r--r--platform/ios/CHANGELOG.md1
-rw-r--r--platform/ios/src/MGLMapView.h12
-rw-r--r--platform/ios/src/MGLMapView.mm8
3 files changed, 21 insertions, 0 deletions
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index 9b883b34c0..98bc6543c9 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -5,6 +5,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
## master
* Client-side text rendering of CJK ideographs is now enabled by default. ([#13988](https://github.com/mapbox/mapbox-gl-native/pull/13988))
+* Added an MGLMapView.prefetchesTiles property that you can disable if you don’t want to prefetch simplified tiles as a performance optimization. ([#14031](https://github.com/mapbox/mapbox-gl-native/pull/14031))
## 4.9.0 - February 27, 2019
diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h
index 5930dc98c1..eae48adf0a 100644
--- a/platform/ios/src/MGLMapView.h
+++ b/platform/ios/src/MGLMapView.h
@@ -352,6 +352,18 @@ MGL_EXPORT IB_DESIGNABLE
*/
@property (nonatomic, assign) MGLMapViewPreferredFramesPerSecond preferredFramesPerSecond;
+/**
+ A Boolean value indicating whether the map should prefetch tiles.
+
+ When this property is set to YES, the map view prefetches loads tiles designed for a
+ low zoom level and displays them until receiving more detailed tiles for the current
+ zoom level. The prefetched tiles typically contain simplified versions of each shape,
+ improving the map view’s perceived performance.
+
+ The default value of this property is YES.
+ */
+@property (nonatomic, assign) BOOL prefetchesTiles;
+
@property (nonatomic) NSArray<NSString *> *styleClasses __attribute__((unavailable("Support for style classes has been removed.")));
- (BOOL)hasStyleClass:(NSString *)styleClass __attribute__((unavailable("Support for style classes has been removed.")));
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 3eeffb9cbd..0c6632f229 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -2630,6 +2630,14 @@ public:
}
}
+- (void)setPrefetchesTiles:(BOOL)prefetchesTiles{
+ _mbglMap->setPrefetchZoomDelta(prefetchesTiles ? mbgl::util::DEFAULT_PREFETCH_ZOOM_DELTA : 0);
+}
+
+- (BOOL)prefetchesTiles{
+ return _mbglMap->getPrefetchZoomDelta() > 0 ? YES : NO;
+}
+
#pragma mark - Accessibility -
- (NSString *)accessibilityValue