Ver Fonte

fix issue where slide transitions were still running for auto-animated slides in Safari

Hakim El Hattab há 5 anos atrás
pai
commit
fe75be1cff
2 ficheiros alterados com 38 adições e 29 exclusões
  1. 1 1
      dist/reveal.min.js
  2. 37 28
      js/reveal.js

Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
dist/reveal.min.js


+ 37 - 28
js/reveal.js

@@ -1212,15 +1212,11 @@ export default function( revealElement, options ) {
 		indexh = updateSlides( HORIZONTAL_SLIDES_SELECTOR, h === undefined ? indexh : h );
 		indexv = updateSlides( VERTICAL_SLIDES_SELECTOR, v === undefined ? indexv : v );
 
-		// Update the visibility of slides now that the indices have changed
-		updateSlidesVisibility();
-
-		layout();
+		// Dispatch an event if the slide changed
+		let slideChanged = ( indexh !== indexhBefore || indexv !== indexvBefore );
 
-		// Update the overview if it's currently active
-		if( overview.isActive() ) {
-			overview.update();
-		}
+		// Ensure that the previous slide is never the same as the current
+		if( !slideChanged ) previousSlide = null;
 
 		// Find the current horizontal slide and any possible vertical slides
 		// within it
@@ -1230,18 +1226,37 @@ export default function( revealElement, options ) {
 		// Store references to the previous and current slides
 		currentSlide = currentVerticalSlides[ indexv ] || currentHorizontalSlide;
 
+		let autoAnimateTransition = false;
+
+		// Detect if we're moving between two auto-animated slides
+		if( slideChanged && previousSlide && currentSlide && !overview.isActive() ) {
+			// If this is an auto-animated transition, we disable the
+			// regular slide transition
+			//
+			// Note 20-03-2020:
+			// This needs to happen before we update slide visibility,
+			// otherwise transitions will still run in Safari.
+			if( previousSlide.hasAttribute( 'data-auto-animate' ) && currentSlide.hasAttribute( 'data-auto-animate' ) ) {
+				autoAnimateTransition = true;
+				dom.slides.classList.add( 'disable-slide-transitions' );
+			}
+		}
+
+		// Update the visibility of slides now that the indices have changed
+		updateSlidesVisibility();
+
+		layout();
+
+		// Update the overview if it's currently active
+		if( overview.isActive() ) {
+			overview.update();
+		}
+
 		// Show fragment, if specified
 		if( typeof f !== 'undefined' ) {
 			fragments.goto( f );
 		}
 
-		// Dispatch an event if the slide changed
-		let slideChanged = ( indexh !== indexhBefore || indexv !== indexvBefore );
-		if (!slideChanged) {
-			// Ensure that the previous slide is never the same as the current
-			previousSlide = null;
-		}
-
 		// Solves an edge case where the previous slide maintains the
 		// 'present' class when navigating between adjacent vertical
 		// stacks
@@ -1318,21 +1333,15 @@ export default function( revealElement, options ) {
 		cueAutoSlide();
 
 		// Auto-animation
-		if( slideChanged && previousSlide && currentSlide && !overview.isActive() ) {
+		if( autoAnimateTransition ) {
 
-			// Skip the slide transition between our two slides
-			// when auto-animating individual elements
-			if( previousSlide.hasAttribute( 'data-auto-animate' ) && currentSlide.hasAttribute( 'data-auto-animate' ) ) {
-				dom.slides.classList.add( 'disable-slide-transitions' );
+			setTimeout( () => {
+				dom.slides.classList.remove( 'disable-slide-transitions' );
+			}, 0 );
 
-				setTimeout( () => {
-					dom.slides.classList.remove( 'disable-slide-transitions' );
-				}, 0 );
-
-				if( config.autoAnimate ) {
-					// Run the auto-animation between our slides
-					autoAnimate.run( previousSlide, currentSlide );
-				}
+			if( config.autoAnimate ) {
+				// Run the auto-animation between our slides
+				autoAnimate.run( previousSlide, currentSlide );
 			}
 
 		}

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff