-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Text label with zoom stops behaves incorrectly on Android #6303
Comments
After some experimentation I found that adding an extra stop to the function makes it work on Android. Changing the above example to: "text-field": {
"base": 1,
"stops": [
[
0,
"{code}"
],
[
9,
"{code}"
],
[
10,
"{name}"
],
[
22,
"{name}"
]
]
} results in {code} being shown up to zoom level 10. |
Possibly same root cause as #5823. |
This begs the question as to what is the expected behaviour. With numeric functions it's possible to interpolate, but where the values are discrete there needs to be some other algorithm. Is this specified anywhere? If not I propose the following for functions with discrete values:
This shouldn't break anything existing, but will make my original example and that from #5823 work as expected. |
Ok, reading the mapbox-gl-native code, it appears the current algorithm chooses the higher zoom stop if it exists, i.e. the reverse of my proposal. That's a reasonable implementation (if documented) but it does not behave in the same manner as the Studio preview. One or the other needs to change. I tried looking at the mapbox-gl-js code to see what it does, but I don't speak Javascript so I couldn't figure it out. |
Fixed in #6328. |
Platform: Android:
Mapbox SDK version 4.2.0-beta.2:
Steps to trigger behavior
I have a style that changes labels for a point based on zoom level:
Previewing this map in Studio, or using the sharing URL gives the expected behaviour, i.e. the label displays the {code} property at low zoom levels, and the {name} property at high zoom levels:
. When using this map in an Android app only the higher zoom label ({name} in the above example) is displayed, irrespective of the zoom level.
Actual behavior
The text was updated successfully, but these errors were encountered: