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

Interaction with circles #21

Open
letmaik opened this issue Jul 1, 2015 · 3 comments
Open

Interaction with circles #21

letmaik opened this issue Jul 1, 2015 · 3 comments

Comments

@letmaik
Copy link

letmaik commented Jul 1, 2015

Is there any way to add some UI interaction with the drawn circles? Like onclick or hover? I'm thinking about custom logic that could be added, like when you click somewhere and two or more circles overlap then you would get the positions in your event listener and can then create a popup which may match the position to some other data. A better way would probably be if an ID could be attached to each circle which could then alternatively be used in the event handler.

@domoritz
Copy link
Owner

domoritz commented Jul 1, 2015

No. The thing is that the circles are drawn on a canvas and are thus not objects.It would be super easy though to add an even handler that translates the mouse coordinates to lat lon and then finds the position in the quad tree. Feel free to send a pr and ask any questions about this.

@letmaik
Copy link
Author

letmaik commented Jul 1, 2015

I wonder how it compares in performance to just using CircleMarker or Circle on a LayerGroup, similar to https://github.com/mourner/Leaflet-Dotter which also uses a canvas. Obviously only for the case where noMask: true. Then bindPopup is available for example, although it probably use quite some memory for many circles.

@domoritz
Copy link
Owner

domoritz commented Jul 1, 2015

I'm not sure. I suspect that my implementation is very fast since it uses a quad tree to do the hit test. It's a log n algorithm.

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

2 participants