diff options
author | M.Stephen <truestyle2005@163.com> | 2019-06-03 15:14:42 +0800 |
---|---|---|
committer | M.Stephen <truestyle2005@163.com> | 2019-06-03 15:14:42 +0800 |
commit | 8655b5995df1a826e4447376a3fec04f5259eab4 (patch) | |
tree | fab2fac2469aff9c6c47712fbfc5f6db97780d87 | |
parent | 1637a4b69449ae4919d39fdf6384fcdf1a003a3a (diff) | |
download | qtlocation-mapboxgl-8655b5995df1a826e4447376a3fec04f5259eab4.tar.gz |
[macos]Added an `MGLMapView.prefetchesTiles` property to configure lower-resolution tile prefetching behavior
-rw-r--r-- | platform/macos/src/MGLMapView.h | 13 | ||||
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 5 |
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; } |