When the component moves automatically via autoplay prop, there is the possibility to play/pause that movement via JavaScript with carouselRef.pause() and carouselRef.resume() methods.
If resume is called when the carousel is already playing, the component moves by 2 slides instead of just one. If the method gets called again, the movement increases to three slides each time.
Bug description
When the component moves automatically via
autoplay
prop, there is the possibility to play/pause that movement via JavaScript withcarouselRef.pause()
andcarouselRef.resume()
methods.If
resume
is called when the carousel is already playing, the component moves by 2 slides instead of just one. If the method gets called again, the movement increases to three slides each time.Here is an example of it: https://svelte.dev/repl/f4e6f8863c3c47f4b64aa2ba9f32795d?version=3.32.0
Ideally, a call to
resume
when the component is already auto-playing should have no effect at all.Technical fix
The current implementation of
resume
just adds and additional interval as long asautoplay
prop is passed:This PR just extends that condition to avoid adding a new interval if there is already one active.