Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[macos]Added an MGLMapView.prefetchesTiles property to configure lo… (
Browse files Browse the repository at this point in the history
#14816)

* [macos]Added an `MGLMapView.prefetchesTiles` property to configure lower-resolution tile prefetching behavior

* [macos]Update changelog
  • Loading branch information
m-stephen authored Jun 4, 2019
1 parent 015a64b commit 6742017
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions platform/macos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## master

* Added an `MGLMapView.prefetchesTiles` property to configure lower-resolution tile prefetching behavior. ([#14816](https://github.com/mapbox/mapbox-gl-native/pull/14816))

### Styles and rendering

* Setting `MGLMapView.contentInset` now moves the map’s focal point to the center of the content frame after insetting. ([#14664](https://github.com/mapbox/mapbox-gl-native/pull/14664))
Expand Down
13 changes: 13 additions & 0 deletions platform/macos/src/MGLMapView.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand Down
5 changes: 5 additions & 0 deletions platform/macos/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,11 @@ - (IBAction)reloadStyle:(__unused id)sender {
self.styleURL = styleURL;
}

- (void)setPrefetchesTiles:(BOOL)prefetchesTiles
{
_mbglMap->setPrefetchZoomDelta(prefetchesTiles ? mbgl::util::DEFAULT_PREFETCH_ZOOM_DELTA : 0);
}

- (mbgl::Map *)mbglMap {
return _mbglMap;
}
Expand Down

0 comments on commit 6742017

Please sign in to comment.