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

How can I pass a className to individual points? #102

Open
neilm-code opened this issue Apr 16, 2021 · 2 comments
Open

How can I pass a className to individual points? #102

neilm-code opened this issue Apr 16, 2021 · 2 comments

Comments

@neilm-code
Copy link

neilm-code commented Apr 16, 2021

Hi, I know I can pass a custom className for the whole canvas. But I was wondering if there is any way to pass a custom className to the individual rendered points right now?

To put this in context, I am basically trying to hide individual points on click trigger. If passing the custom className to individual points after the render is not supported atm, do you have any thoughts/suggestions on how I can do that with the functionality that is already there?

Thank you guys, you are doing a great job ❤️

@smellyshovel
Copy link

I'm pretty much sure you can not at all, since points rendered on canvas are not HTML elements.

If you want to dynamically hide/show certain points, you should change the data source during the runtime and trigger re-render (there may be better ways to do so, though that's the only one I know, and most certainly it should work).

@melgrove
Copy link
Contributor

melgrove commented Jun 4, 2022

@neilm-code Doable by storing the index of the point in the properties of its GeoJSON. Then write your click handler to get the index from the feature and pass it to .remove(). Here's an example of how I've used this method to fetch data about the point on click: see renderGeography()

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