Skip to content
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

When hovering a symbol, the transition is too long (v0.44.2) #6572

Closed
Roxyi opened this issue Apr 27, 2018 · 2 comments
Closed

When hovering a symbol, the transition is too long (v0.44.2) #6572

Roxyi opened this issue Apr 27, 2018 · 2 comments
Assignees

Comments

@Roxyi
Copy link

Roxyi commented Apr 27, 2018

I checked the release info from v0.44.0 to v0.44.2 but didn't have a clue which fix or new feature makes the transition longer.

I created a demo: https://jsfiddle.net/yixu/trq96bkh/
When you hover over the symbol, you will notice the transition. If you change the version to v.43.0, the transition is much faster. The transition in v0.44.2 is a bit too long for a good hover effect.

@jfirebaugh
Copy link
Contributor

cc @ChrisLoer

@ChrisLoer
Copy link
Contributor

Hi @Roxyi, the relevant change is PR #6497, which fixed a number of edge cases in which the results of queryRenderedFeatures (which is used to implement mouseenter/mouseleave and thus needed for hover effects) were temporarily incorrect. That could cause flickering as described in #5506. The behavior in v0.43 was sometimes faster, but also not quite correct (in your demo I can see the markers flicker on and off).

The reason for the delay is that when we change the marker state we have to re-run collision detection to see if the markers collide with any other symbols on the map (even though the markers don't actually change size, the collision detection code doesn't know that until it runs). Because collision detection is relatively expensive, we only run it once every 300ms. That introduces the delay you see.

I played around with your fiddle, and you can get a pretty good hover effect by setting text-allow-overlap and icon-allow-overlap to true for both layers (test-marker and test-marker-hover). By turning on "allow overlap", you get rid of the collision detection requirement, so the marker can display instantly. The downside of this approach is that the markers can overlap with each other -- in a production app, one way to approach this problem would be to control the density of markers based on tile zoom level so that there's not too much overlap.

I'm closing this because it looks like intended behavior, but I understand the collision detection timing requirements are difficult to work with for hover-states, and that's something we'll continue to look at as we make improvements.

@ChrisLoer ChrisLoer self-assigned this Apr 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants