delay slide jumps a few ms
This commit is contained in:
parent
79e9fdf13f
commit
282680e163
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -45,6 +45,9 @@ export default class JumpToSlide {
|
||||||
if( this.isVisible() ) {
|
if( this.isVisible() ) {
|
||||||
this.element.remove();
|
this.element.remove();
|
||||||
this.jumpInput.value = '';
|
this.jumpInput.value = '';
|
||||||
|
|
||||||
|
clearTimeout( this.jumpTimeout );
|
||||||
|
delete this.jumpTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -60,6 +63,9 @@ export default class JumpToSlide {
|
||||||
*/
|
*/
|
||||||
jump() {
|
jump() {
|
||||||
|
|
||||||
|
clearTimeout( this.jumpTimeout );
|
||||||
|
delete this.jumpTimeout;
|
||||||
|
|
||||||
const value = this.jumpInput.value.trim( '' );
|
const value = this.jumpInput.value.trim( '' );
|
||||||
const indices = this.Reveal.location.getIndicesFromHash( value );
|
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
|
* Reverts back to the slide we were on when jump to slide was
|
||||||
* invoked.
|
* invoked.
|
||||||
|
@ -116,7 +129,7 @@ export default class JumpToSlide {
|
||||||
|
|
||||||
onInput( event ) {
|
onInput( event ) {
|
||||||
|
|
||||||
this.jump();
|
this.jumpAfter( 200 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue