Skip to content

Commit

Permalink
fix slide numbering issue with uncounted horizontal slides (fixes #2675)
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Jun 5, 2020
1 parent 37d8337 commit 66cbd66
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/reveal.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.js

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions js/controllers/slidenumber.js
Expand Up @@ -72,17 +72,20 @@ export default class SlideNumber {
format = 'c';
}

// Offset the current slide number by 1 to make it 1-indexed
let horizontalOffset = slide && slide.dataset.visibility === 'uncounted' ? 0 : 1;

value = [];
switch( format ) {
case 'c':
value.push( this.Reveal.getSlidePastCount( slide ) + 1 );
value.push( this.Reveal.getSlidePastCount( slide ) + horizontalOffset );
break;
case 'c/t':
value.push( this.Reveal.getSlidePastCount( slide ) + 1, '/', this.Reveal.getTotalSlides() );
value.push( this.Reveal.getSlidePastCount( slide ) + horizontalOffset, '/', this.Reveal.getTotalSlides() );
break;
default:
let indices = this.Reveal.getIndices( slide );
value.push( indices.h + 1 );
value.push( indices.h + horizontalOffset );
let sep = format === 'h/v' ? '/' : '.';
if( this.Reveal.isVerticalSlide( slide ) ) value.push( sep, indices.v + 1 );
}
Expand Down
2 changes: 1 addition & 1 deletion js/reveal.js
Expand Up @@ -1793,7 +1793,7 @@ export default function( revealElement, options ) {

// Don't count the wrapping section for vertical slides and
// slides marked as uncounted
if( horizontalSlide.classList.contains( 'stack' ) === false && !horizontalSlide.dataset.visibility !== 'uncounted' ) {
if( horizontalSlide.classList.contains( 'stack' ) === false && horizontalSlide.dataset.visibility !== 'uncounted' ) {
pastCount++;
}

Expand Down

0 comments on commit 66cbd66

Please sign in to comment.