-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Hand cursor, mousover and mouseout events for canvas paths #1403
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
Conversation
|
I hesitated to add this because of performance concerns, did you run any benchmarks? How does it cope with the debug/vector/vector-canvas.html example with 50k points? What does the profiler say? And also change polyline to polygon and check that too. Also, I think if we add mouseover event for paths, we need to add mouseout too. |
|
Yeah, I was betting that was the reason this isn't in yet. I'm no expert on canvas or JS benchmarking, but figured I would give it a try because I feel it will help usability in our app. It definitely it takes up some resources from what the profiler says,but entirely usable on my MBA(until you try to zoom).Then things get a bit choppy. |
|
So on that zoom point, this helped at the top of _onMouseMove |
|
mouseout in now too. |
|
Thanks! I think I'll merge it in a separate branch, make some performance experiments and see if we can optimize it (e.g. using some requestAnimFrame or timer tricks). |
|
We could try doing something like client-side utfgrid if performance isn't great ;) |
|
But on the other hand we wouldn't want to write lots of code to support a relatively minor feature. :) So we need to compromise. |
|
Yeah of course :) |
|
Started playing with the pull. It seems that currently the bottleneck is not running point-in-poly algorithm on all features, but the redrawing mechanism itself. See #1466. |
|
Merged the pull and cleaned up a bit. |
|
On layer remove, the |
|
@jfgirard can you provide a fiddle for that?I understand what you are saying and agree, but can't reproduce it. Wondering if it got fixed in another place somehow? |
|
@snkashis right, there are no more error because of https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/canvas/Path.Canvas.js#L139 But the removed layer creates a memory leak by being a listener on mousemove event. |
|
Thanks for the heads up! PR submitted. |
|
Cool. You're welcome. |
Provides the proper cursor if options.clickable = true for canvas paths.
Also, fixed one of the canvas test pages that was broken, since it was my testbed.