From 8579fc773d4e0a735e808635f12a2782d9e9623f Mon Sep 17 00:00:00 2001 From: Greg Denehy Date: Sat, 25 Nov 2017 11:07:09 +1030 Subject: [PATCH] Fixed issue with getProgress() when called from slidechanged event on edge case --- js/reveal.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index 9a43903e..1a98ac9e 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -2411,16 +2411,7 @@ // Dispatch an event if the slide changed var slideChanged = ( indexh !== indexhBefore || indexv !== indexvBefore ); - if( slideChanged ) { - dispatchEvent( 'slidechanged', { - 'indexh': indexh, - 'indexv': indexv, - 'previousSlide': previousSlide, - 'currentSlide': currentSlide, - 'origin': o - } ); - } - else { + if (!slideChanged) { // Ensure that the previous slide is never the same as the current previousSlide = null; } @@ -2448,6 +2439,16 @@ } } + if( slideChanged ) { + dispatchEvent( 'slidechanged', { + 'indexh': indexh, + 'indexv': indexv, + 'previousSlide': previousSlide, + 'currentSlide': currentSlide, + 'origin': o + } ); + } + // Handle embedded content if( slideChanged || !previousSlide ) { stopEmbeddedContent( previousSlide );