Merge branch 'master' into fix-pdf-page-numbering

edit
Hakim El Hattab 2022-04-04 15:25:14 +02:00 committed by GitHub
commit 25ed8f2c47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 9 deletions

1
dist/reveal.esm.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/reveal.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1571,15 +1571,20 @@ export default function( revealElement, options ) {
slidesLength = slides.length;
let printMode = print.isPrintingPDF();
let loopedForwards = false;
let loopedBackwards = false;
if( slidesLength ) {
// Should the index loop?
if( config.loop ) {
if( index >= slidesLength ) loopedForwards = true;
index %= slidesLength;
if( index < 0 ) {
index = slidesLength + index;
loopedBackwards = true;
}
}
@ -1617,10 +1622,7 @@ export default function( revealElement, options ) {
if( config.fragments ) {
// Show all fragments in prior slides
Util.queryAll( element, '.fragment' ).forEach( fragment => {
fragment.classList.add( 'visible' );
fragment.classList.remove( 'current-fragment' );
} );
showFragmentsIn( element );
}
}
else if( i > index ) {
@ -1629,9 +1631,17 @@ export default function( revealElement, options ) {
if( config.fragments ) {
// Hide all fragments in future slides
Util.queryAll( element, '.fragment.visible' ).forEach( fragment => {
fragment.classList.remove( 'visible', 'current-fragment' );
} );
hideFragmentsIn( element );
}
}
// Update the visibility of fragments when a presentation loops
// in either direction
else if( i === index && config.fragments ) {
if( loopedForwards ) {
hideFragmentsIn( element );
}
else if( loopedBackwards ) {
showFragmentsIn( element );
}
}
}
@ -1671,6 +1681,29 @@ export default function( revealElement, options ) {
}
/**
* Shows all fragment elements within the given contaienr.
*/
function showFragmentsIn( container ) {
Util.queryAll( container, '.fragment' ).forEach( fragment => {
fragment.classList.add( 'visible' );
fragment.classList.remove( 'current-fragment' );
} );
}
/**
* Hides all fragment elements within the given contaienr.
*/
function hideFragmentsIn( container ) {
Util.queryAll( container, '.fragment.visible' ).forEach( fragment => {
fragment.classList.remove( 'visible', 'current-fragment' );
} );
}
/**
* Optimization method; hide all slides that are far away
* from the present slide.