-
Notifications
You must be signed in to change notification settings - Fork 110
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
Callback function ? #1
Comments
Thanks @nhinze. That's a really interesting idea. I'll try to carve out some time for it. I'm happy to help out with questions if you want to take a stab at it. |
I added a little pull request that shows how I edited your code to send the distance travelled to a custom function at each interval. However, something cleaner would be nice. I'm not very familiar with leaflet yet. |
Thank @nhinze. I glanced at it and I think there's probably a better way to tackle it. Your solution calls the callback at each vertex which could end up being less an ideal if you have a line that's 100 miles long but only a start and end point, for example. You'd only get callbacks on start and finish. @mourner recommended that I check out the new DomPosition util to implement the animation. There might be something in there to help. Again, thanks for the idea and the code ideas. Much appreciated! |
Actually, the hack I did calls the function at minimum at each "interval". I have it set at 1000 ms, so I get a position/distance update at least every 1s. However, I do agree that my hack is a dirty solution and there is probably a better way. |
Hi,
great little plugin. It would be nice to be able to define a callback function that would receive the current status of the animation (current distance travelled, lat/long, time?) so that events can be triggered along the path when the marker reaches a certain spot. I'm hacking it it right now, but it would be a nice feature.
Thanks,
Nick,
The text was updated successfully, but these errors were encountered: