hosuaby / Leaflet.SmoothMarkerBouncing

Smooth animation of marker bouncing for Leaflet.
BSD 2-Clause "Simplified" License
146 stars 28 forks source link

Fix isBouncing problem #16

Closed Satrige closed 5 years ago

Satrige commented 6 years ago

I noticed that flag isBouncing set to false before the animation is over, because it is made before drawing animation steps. So when I try to check if animation is over isBouncing() function tells me that is has ended, but animation is still drawing at this moment. So I moved the code checking if animation is over to the setTimeout which must invoke after drawing the animation.

hosuaby commented 6 years ago

This behaiviour is completely normal. When marker is requested to stop bouncing, it sets flag marker._bouncingMotion.isBouncing to false, but animation dont stop abruptly, it continue until its end. If you really need to know if animation of bouncing came to it's end you can check in your code flag marker._bouncingMotion.bouncingAnimationPlaying

hosuaby commented 5 years ago

Since v1.3.0 it's possible to subscribe on event "bounceend" to capture the end of animation.