浏览代码

fix slide numbering issue with uncounted horizontal slides (fixes #2675)

Hakim El Hattab 5 年之前
父节点
当前提交
66cbd66fb6
共有 4 个文件被更改,包括 7 次插入4 次删除
  1. 0 0
      dist/reveal.esm.js
  2. 0 0
      dist/reveal.js
  3. 6 3
      js/controllers/slidenumber.js
  4. 1 1
      js/reveal.js

文件差异内容过多而无法显示
+ 0 - 0
dist/reveal.esm.js


文件差异内容过多而无法显示
+ 0 - 0
dist/reveal.js


+ 6 - 3
js/controllers/slidenumber.js

@@ -72,17 +72,20 @@ export default class SlideNumber {
 				format = 'c';
 				format = 'c';
 			}
 			}
 
 
+			// Offset the current slide number by 1 to make it 1-indexed
+			let horizontalOffset = slide && slide.dataset.visibility === 'uncounted' ? 0 : 1;
+
 			value = [];
 			value = [];
 			switch( format ) {
 			switch( format ) {
 				case 'c':
 				case 'c':
-					value.push( this.Reveal.getSlidePastCount( slide ) + 1 );
+					value.push( this.Reveal.getSlidePastCount( slide ) + horizontalOffset );
 					break;
 					break;
 				case 'c/t':
 				case 'c/t':
-					value.push( this.Reveal.getSlidePastCount( slide ) + 1, '/', this.Reveal.getTotalSlides() );
+					value.push( this.Reveal.getSlidePastCount( slide ) + horizontalOffset, '/', this.Reveal.getTotalSlides() );
 					break;
 					break;
 				default:
 				default:
 					let indices = this.Reveal.getIndices( slide );
 					let indices = this.Reveal.getIndices( slide );
-					value.push( indices.h + 1 );
+					value.push( indices.h + horizontalOffset );
 					let sep = format === 'h/v' ? '/' : '.';
 					let sep = format === 'h/v' ? '/' : '.';
 					if( this.Reveal.isVerticalSlide( slide ) ) value.push( sep, indices.v + 1 );
 					if( this.Reveal.isVerticalSlide( slide ) ) value.push( sep, indices.v + 1 );
 			}
 			}

+ 1 - 1
js/reveal.js

@@ -1793,7 +1793,7 @@ export default function( revealElement, options ) {
 
 
 			// Don't count the wrapping section for vertical slides and
 			// Don't count the wrapping section for vertical slides and
 			// slides marked as uncounted
 			// 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++;
 				pastCount++;
 			}
 			}
 
 

部分文件因为文件数量过多而无法显示