-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zooming out and quickly using setData after that causes labels to vanish #5837
Comments
JSFiddle: https://jsfiddle.net/c0tg4h5o/ First zoom in, and then zoom out. You are likely to see the red labels to disappear. Repeat for a few times if it does not happen or change the interval to be shorter. |
cc @ChrisLoer @ansis |
This sounds like #5741, which has merged to |
#5471 removes the unnecessary transition effect but this is also in master. |
Oops, sorry for jumping to conclusions @ttsirkia! I can at least sometimes reproduce this locally, and it looks like there's some sort of starvation condition when |
@ttsirkia Sorry I'm a little unclear from the report, but is the problem you're seeing that labels disappear and then never reappear, or is it just that they disappear and then after some time start showing? The behavior I think I'm seeing locally is that when If it's just a matter of tiles from the 'data' source you created taking longer to load than tiles from the 'towns' and 'smalltowns' source, it's not too hard to explain the disappearance. Say you're at zoom level 10 showing tiles from all three data sources, then you zoom out to zoom level 6. As you zoom out, 'towns' and 'smalltowns' will be busy replacing their tiles with tiles at different zooms, but 'data' won't be updated in time. I believe we have a max underzooming of 3 set in SourceCache, so by the time you get to zoom level 6, we won't keep displaying the old z10 tile for 'data', and the circles will disappear for a while. |
The problem description was indeed a bit unclear. The problem is that the red labels will vanish and they won't appear again before zooming back in. I made an animation so that we can be sure that the situation is the same because I noticed that the parameters may have to be changed a little depending on the computer. In that example the density of town labels is quite high but in my application there is plenty of space to place the labels so the reason cannot be that there are overlapping labels. In my app, the update period is 2 seconds but because the map in the example is so trivial, I had to generate quite a lot the labels and circles with short update period to get the issue be visible. |
Let's see if I'm paying attention to the right things... In your screen grab, I see:
So the unexpected behavior is not so much that the entire |
Yes, that is exactly the case! There is also one variation. With some computers the circles do not disappear at all (frames 14 - 25), only the labels. Otherwise the result is the same. Or at least the time for the hidden circles is so short that it cannot be seen. |
Ah thanks, I get it now. I totally got distracted looking at the wrong problem, although maybe we should do something to reduce the amount of unnecessary work when The reason the labels aren't showing up is that they're marked "duplicate" in the
This race condition exists for vector tiles loaded from the network too, but you're less likely to see it because When this does happen for a given tile X at say zoom 12, it will cause duplicate symbols from tile X to be hidden in parent tiles until tile X is reloaded. So for instance if "New York" was present in tile X, it could be hidden all the way out to much lower zooms. 😬 I believe @ansis's work back-porting the |
Nice to hear that you were able to track the root cause of the problem! The workaround seems to work perfectly so not very urgent issue and kind of rare to occur if there are only static elements. |
…der tree. Fixes issue #5837, which could cause symbols to be incorrectly hidden.
…der tree. Fixes issue #5837, which could cause symbols to be incorrectly hidden.
Thank you for very quick fix! Yes, I can confirm that I cannot reproduce the issue anymore. |
mapbox-gl-js version: 0.42.2
Steps to Trigger Behavior
setData
Expected Behavior
Labels stay visible.
Actual Behavior
Labels may disappear.
In my case, I have
setInterval
with interval of 2 seconds. It seems that if the updating function which eventually callssetData
is called when the visible labels is still being calculated after zooming out, most of the labels will become invisible.There is a workaround which seems to work. Prevent
setData
being called before, for example, two seconds has passed after zooming.I'm trying to generate a JSFiddle which is the smallest working example.
The text was updated successfully, but these errors were encountered: