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

featuresAt sometimes returns nothing after layer's source is modified #1911

Closed
andest01 opened this issue Jan 8, 2016 · 4 comments
Closed

Comments

@andest01
Copy link

andest01 commented Jan 8, 2016

featuresAt works fine after adding about 50,000 symbols in a small cluster. If I implement a click to center (e.g. https://www.mapbox.com/mapbox-gl-js/example/center-on-symbol/ ), each click centers perfectly. However, when rapidly adding and removing elements to the layer's source, some calls to featuresAt do not return any features, even when clicking over several symbols. It works, but intermittently.

Here is a plunkr that reproduces this issue:
https://plnkr.co/edit/3COaxhnCjlLTr1YQt2nW?p=preview

Steps to reproduce:
1). Open Chrome Dev Tools and open the plunkr
2). Ensure the line startJittering(); is not commented out. Observe the thousands of gray symbols, and notice that they seem to "shimmer" slightly due to elements being added and removed very quickly.
3). Click inside the cluster of gray symbols. Note that some clicks do not center, and a log is shown in the developer console that says "EMPTY CLICK DETECTED".

Expected behavior:
featuresAt returns several features over the cluster, even when elements have been added and removed.

To stop the bug and see correct behavior, comment out the line startJittering(); Clicking anywhere in the cluster now works perfectly.

All that startJittering does is create a setInterval that adds and removes data from the source. I assume this is considered correct use of the API.

@ansis
Copy link
Contributor

ansis commented Mar 24, 2016

I wasn't able to reproduce the issue

v0.16.0 replaces featuresAt with queryRenderedFeatures. Can you check if this is still an issue for you with v0.16.0?

@andest01
Copy link
Author

andest01 commented Apr 7, 2016

I'd be happy to try this out.

@tmcw
Copy link
Contributor

tmcw commented May 17, 2016

@andest01 any luck trying your code with the new queryRenderedFeatures method?

@lucaswoj
Copy link
Contributor

Closing as stale. Potential duplicate of #2647

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

4 participants