瀏覽代碼

Fix target for click on progress bar

The progress bar shows how many slides have been passed in total.
However, when clicking on the progress bar, the target slide is
computed among the subset of /horizontal/ slides.  Thus, when the new
slide is displayed, the progress bar has usually changed to a point
that is unrelated to the clicked one, which I find surprising.

With this change, the target slide is computed from the number of
total slides.  Thus, after a click on the progress bar, the resulting
progress is close to the clicked point, which seems more natural to
me.
Jens Lechtenbörger 4 年之前
父節點
當前提交
d2dff6a821
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      js/controllers/progress.js

+ 4 - 2
js/controllers/progress.js

@@ -88,14 +88,16 @@ export default class Progress {
 
 
 		event.preventDefault();
 		event.preventDefault();
 
 
-		let slidesTotal = this.Reveal.getHorizontalSlides().length;
+		let slides = this.Reveal.getSlides();
+		let slidesTotal = slides.length;
 		let slideIndex = Math.floor( ( event.clientX / this.getMaxWidth() ) * slidesTotal );
 		let slideIndex = Math.floor( ( event.clientX / this.getMaxWidth() ) * slidesTotal );
 
 
 		if( this.Reveal.getConfig().rtl ) {
 		if( this.Reveal.getConfig().rtl ) {
 			slideIndex = slidesTotal - slideIndex;
 			slideIndex = slidesTotal - slideIndex;
 		}
 		}
 
 
-		this.Reveal.slide( slideIndex );
+		let targetIndices = this.Reveal.getIndices(slides[slideIndex]);
+		this.Reveal.slide( targetIndices.h, targetIndices.v );
 
 
 	}
 	}