-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add option to prefetch low-resolution tiles #14031
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested changelog entry:
- Added an
MGLMapView.prefetchesTiles
property that you can disable if you don’t want to prefetch simplified tiles as a performance optimization. (#14031)
@tmpsantos, are you comfortable with the approach of making this a Boolean option, as I proposed in #9438 (comment), or do you think developers need the flexibility of specifying a zoom level to prefetch?
platform/ios/src/MGLMapView.mm
Outdated
else | ||
{ | ||
//Reset to default value. | ||
_mbglMap->setPrefetchZoomDelta(4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per #9438 (comment), use the constant DEFAULT_PREFETCH_ZOOM_DELTA
instead of hard-coding the literal number 4. Also, the if/else statement can be written more succinctly as a ternary expression: setPrefetchZoomDelta(prefetchesTiles ? DEFAULT_PREFETCH_ZOOM_DELTA : 0)
.
platform/ios/src/MGLMapView.h
Outdated
|
||
Loads tiles at a lower zoom-level to pre-render a low resolution preview while more detailed tiles are loaded. | ||
|
||
Default is YES. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The developer may be unfamiliar with the concept of prefetching simplified tiles, so here’s an attempt at making the mechanism easy to understand:
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 isYES
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. That's a better one. I'll change to that.
FYI, this has been implemented only with a boolean value on Android side. @1ec5 |
I'm ok with the boolean option for the sake of consistence with Android. |
@@ -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)) |
There was a problem hiding this comment.
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:
* 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)) |
Closes: #9438
We got a loading issue report from our customer.
I've added a boolean-typed prefetchesTiles property to MGLMapView to fix this issue.
Could you help to review these codes? @1ec5 @friedbunny