From a87c4d97a018b254229996ab4b1bd632c244cb60 Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Sun, 23 Feb 2020 10:52:03 +0300 Subject: [PATCH 1/2] Fix slideshow start/stop --- src/components/slideshow/slideshow.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/slideshow/slideshow.js b/src/components/slideshow/slideshow.js index f31ac091b5..922cda34b0 100644 --- a/src/components/slideshow/slideshow.js +++ b/src/components/slideshow/slideshow.js @@ -342,7 +342,9 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f btnSlideshowPause.innerHTML = "pause"; } - swiperInstance.startAutoplay(); + if (swiperInstance.autoplay) { + swiperInstance.autoplay.start(); + } } function pause() { @@ -352,7 +354,9 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f btnSlideshowPause.innerHTML = ""; } - swiperInstance.stopAutoplay(); + if (swiperInstance.autoplay) { + swiperInstance.autoplay.stop(); + } } function playPause() { From baea3593a5b388b77a615487f8955bd9a8153185 Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Sun, 23 Feb 2020 11:48:01 +0300 Subject: [PATCH 2/2] Sync button state with actual autoplay state --- src/components/slideshow/slideshow.js | 29 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/components/slideshow/slideshow.js b/src/components/slideshow/slideshow.js index 922cda34b0..dffe8c2f78 100644 --- a/src/components/slideshow/slideshow.js +++ b/src/components/slideshow/slideshow.js @@ -198,6 +198,20 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f } } + function onAutoplayStart() { + var btnSlideshowPause = dlg.querySelector('.btnSlideshowPause i'); + if (btnSlideshowPause) { + btnSlideshowPause.innerHTML = "pause"; + } + } + + function onAutoplayStop() { + var btnSlideshowPause = dlg.querySelector('.btnSlideshowPause i'); + if (btnSlideshowPause) { + btnSlideshowPause.innerHTML = ""; + } + } + function loadSwiper(dlg) { if (currentOptions.slides) { @@ -225,6 +239,9 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f speed: 240 }); + swiperInstance.on('autoplayStart', onAutoplayStart); + swiperInstance.on('autoplayStop', onAutoplayStop); + if (layoutManager.mobile) { pause(); } else { @@ -336,24 +353,12 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f } function play() { - - var btnSlideshowPause = dlg.querySelector('.btnSlideshowPause i'); - if (btnSlideshowPause) { - btnSlideshowPause.innerHTML = "pause"; - } - if (swiperInstance.autoplay) { swiperInstance.autoplay.start(); } } function pause() { - - var btnSlideshowPause = dlg.querySelector('.btnSlideshowPause i'); - if (btnSlideshowPause) { - btnSlideshowPause.innerHTML = ""; - } - if (swiperInstance.autoplay) { swiperInstance.autoplay.stop(); }