Merge pull request #2836 from lechten/fix-progress-click

Fix target for click on progress bar
edit
Hakim El Hattab 2020-11-30 18:41:10 +01:00 committed by GitHub
commit 49d043c0c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -88,14 +88,16 @@ export default class Progress {
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 );
if( this.Reveal.getConfig().rtl ) {
slideIndex = slidesTotal - slideIndex;
}
this.Reveal.slide( slideIndex );
let targetIndices = this.Reveal.getIndices(slides[slideIndex]);
this.Reveal.slide( targetIndices.h, targetIndices.v );
}