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

Add option to prefetch low-resolution tiles #14031

Merged
merged 5 commits into from
Mar 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions platform/ios/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the backticks help jazzy automatically link to the property’s documentation:

Suggested change
* 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))
* 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

Expand Down
12 changes: 12 additions & 0 deletions platform/ios/src/MGLMapView.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.")));
Expand Down
8 changes: 8 additions & 0 deletions platform/ios/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2630,6 +2630,14 @@ - (void)setShowsScale:(BOOL)showsScale
}
}

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

- (BOOL)prefetchesTiles{
return _mbglMap->getPrefetchZoomDelta() > 0 ? YES : NO;
}

friedbunny marked this conversation as resolved.
Show resolved Hide resolved
#pragma mark - Accessibility -

- (NSString *)accessibilityValue
Expand Down