delay slide jumps a few ms

This commit is contained in:
hakimel 2023-01-16 14:43:50 +01:00
parent 79e9fdf13f
commit 282680e163
5 changed files with 18 additions and 5 deletions

2
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 vendored

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

@ -45,6 +45,9 @@ export default class JumpToSlide {
if( this.isVisible() ) {
this.element.remove();
this.jumpInput.value = '';
clearTimeout( this.jumpTimeout );
delete this.jumpTimeout;
}
}
@ -60,6 +63,9 @@ export default class JumpToSlide {
*/
jump() {
clearTimeout( this.jumpTimeout );
delete this.jumpTimeout;
const value = this.jumpInput.value.trim( '' );
const indices = this.Reveal.location.getIndicesFromHash( value );
@ -74,6 +80,13 @@ export default class JumpToSlide {
}
jumpAfter( delay ) {
clearTimeout( this.jumpTimeout );
this.jumpTimeout = setTimeout( () => this.jump(), delay );
}
/**
* Reverts back to the slide we were on when jump to slide was
* invoked.
@ -116,7 +129,7 @@ export default class JumpToSlide {
onInput( event ) {
this.jump();
this.jumpAfter( 200 );
}