summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorM.Stephen <truestyle2005@163.com>2019-06-03 15:14:42 +0800
committerM.Stephen <truestyle2005@163.com>2019-06-03 15:14:42 +0800
commit8655b5995df1a826e4447376a3fec04f5259eab4 (patch)
treefab2fac2469aff9c6c47712fbfc5f6db97780d87
parent1637a4b69449ae4919d39fdf6384fcdf1a003a3a (diff)
downloadqtlocation-mapboxgl-8655b5995df1a826e4447376a3fec04f5259eab4.tar.gz
[macos]Added an `MGLMapView.prefetchesTiles` property to configure lower-resolution tile prefetching behavior
-rw-r--r--platform/macos/src/MGLMapView.h13
-rw-r--r--platform/macos/src/MGLMapView.mm5
2 files changed, 18 insertions, 0 deletions
diff --git a/platform/macos/src/MGLMapView.h b/platform/macos/src/MGLMapView.h
index ddb5747109..cb4ac8b4ea 100644
--- a/platform/macos/src/MGLMapView.h
+++ b/platform/macos/src/MGLMapView.h
@@ -188,6 +188,19 @@ MGL_EXPORT IB_DESIGNABLE
*/
@property (nonatomic, readonly) NSView *attributionView;
+/**
+ A Boolean value indicating whether the map should prefetch tiles.
+
+ When this property is set to `YES`, the map view prefetches 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;
+
+
#pragma mark Manipulating the Viewpoint
/**
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm
index 589a39f0b3..fc1c3ec434 100644
--- a/platform/macos/src/MGLMapView.mm
+++ b/platform/macos/src/MGLMapView.mm
@@ -654,6 +654,11 @@ public:
self.styleURL = styleURL;
}
+- (void)setPrefetchesTiles:(BOOL)prefetchesTiles
+{
+ _mbglMap->setPrefetchZoomDelta(prefetchesTiles ? mbgl::util::DEFAULT_PREFETCH_ZOOM_DELTA : 0);
+}
+
- (mbgl::Map *)mbglMap {
return _mbglMap;
}