ensure overview indices are up to date if a slide moves
This commit is contained in:
		
							
								
								
									
										27
									
								
								js/reveal.js
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								js/reveal.js
									
									
									
									
									
								
							| @@ -1664,24 +1664,11 @@ | |||||||
| 			// that the same scaling is applied | 			// that the same scaling is applied | ||||||
| 			dom.slides.appendChild( dom.background ); | 			dom.slides.appendChild( dom.background ); | ||||||
|  |  | ||||||
| 			// Bind events so that clicking on a slide navigates to it | 			// Clicking on an overview slide navigates to it | ||||||
| 			toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ).forEach( function( hslide, h ) { | 			toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR ) ).forEach( function( slide ) { | ||||||
|  | 				if( !slide.classList.contains( 'stack' ) ) { | ||||||
| 				hslide.setAttribute( 'data-index-h', h ); | 					slide.addEventListener( 'click', onOverviewSlideClicked, true ); | ||||||
|  |  | ||||||
| 				if( hslide.classList.contains( 'stack' ) ) { |  | ||||||
| 					toArray( hslide.querySelectorAll( 'section' ) ).forEach( function( vslide, v ) { |  | ||||||
|  |  | ||||||
| 						vslide.setAttribute( 'data-index-h', h ); |  | ||||||
| 						vslide.setAttribute( 'data-index-v', v ); |  | ||||||
| 						vslide.addEventListener( 'click', onOverviewSlideClicked, true ); |  | ||||||
|  |  | ||||||
| 					} ); |  | ||||||
| 				} | 				} | ||||||
| 				else { |  | ||||||
| 					hslide.addEventListener( 'click', onOverviewSlideClicked, true ); |  | ||||||
| 				} |  | ||||||
|  |  | ||||||
| 			} ); | 			} ); | ||||||
|  |  | ||||||
| 			updateSlidesVisibility(); | 			updateSlidesVisibility(); | ||||||
| @@ -1718,11 +1705,15 @@ | |||||||
|  |  | ||||||
| 		// Layout slides | 		// Layout slides | ||||||
| 		toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ).forEach( function( hslide, h ) { | 		toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ).forEach( function( hslide, h ) { | ||||||
|  | 			hslide.setAttribute( 'data-index-h', h ); | ||||||
| 			transformElement( hslide, 'translate3d(' + ( h * slideWidth ) + 'px, 0, 0)' ); | 			transformElement( hslide, 'translate3d(' + ( h * slideWidth ) + 'px, 0, 0)' ); | ||||||
|  |  | ||||||
| 			if( hslide.classList.contains( 'stack' ) ) { | 			if( hslide.classList.contains( 'stack' ) ) { | ||||||
|  |  | ||||||
| 				toArray( hslide.querySelectorAll( 'section' ) ).forEach( function( vslide, v ) { | 				toArray( hslide.querySelectorAll( 'section' ) ).forEach( function( vslide, v ) { | ||||||
|  | 					vslide.setAttribute( 'data-index-h', h ); | ||||||
|  | 					vslide.setAttribute( 'data-index-v', v ); | ||||||
|  |  | ||||||
| 					transformElement( vslide, 'translate3d(0, ' + ( v * slideHeight ) + 'px, 0)' ); | 					transformElement( vslide, 'translate3d(0, ' + ( v * slideHeight ) + 'px, 0)' ); | ||||||
| 				} ); | 				} ); | ||||||
|  |  | ||||||
| @@ -1997,7 +1988,7 @@ | |||||||
|  |  | ||||||
| 		// If no vertical index is specified and the upcoming slide is a | 		// If no vertical index is specified and the upcoming slide is a | ||||||
| 		// stack, resume at its previous vertical index | 		// stack, resume at its previous vertical index | ||||||
| 		if( v === undefined ) { | 		if( v === undefined && !isOverview() ) { | ||||||
| 			v = getPreviousVerticalIndex( horizontalSlides[ h ] ); | 			v = getPreviousVerticalIndex( horizontalSlides[ h ] ); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user