Closed timothyarmes closed 1 month ago
I have a work around, but a proper option would be nice.
(if (markerRef.current.isBouncing()) {
// @ts-ignore
markerRef.current.stopBouncing();
// The plugin keeps bouncing until the end of the animation. We want to stop it immediately
// An issue has been raised on the project (https://github.com/hosuaby/Leaflet.SmoothMarkerBouncing/issues/52), until then we have this hack.
// We remove the class and reset some internal state
// @ts-ignore
DomUtil.removeClass(markerRef.current._icon, "bouncing");
if (
// @ts-ignore
markerRef.current?._bouncingMotion?.bouncingAnimationPlaying === true
)
// @ts-ignore
markerRef.current._bouncingMotion.bouncingAnimationPlaying = false;
})
Hello @timothyarmes
Thanks for enhancement proposal. I think, the proper solution would be to add flag immediate
in the arguments of method marker.stopBouncing()
and introduce option stopImmediately
into options of bouncing.
I find your proposal interesting. I will take care of it when I will have some free time. If you need it fast, feel free to make a PR and I will review.
Will be availbale in version 3.1.0
It would be really useful to have a way to instantly stop bouncing, rather than wait till the end of the current animation