stop auto-slide on pause and overview (closes #320)

This commit is contained in:
Hakim El Hattab 2013-02-09 19:04:17 -05:00
parent 380264afc8
commit 2962325fd1
2 changed files with 19 additions and 3 deletions

View file

@ -675,6 +675,9 @@ var Reveal = (function(){
// Only proceed if enabled in config // Only proceed if enabled in config
if( config.overview ) { if( config.overview ) {
// Don't auto-slide while in overview mode
cancelAutoSlide();
var wasActive = dom.wrapper.classList.contains( 'overview' ); var wasActive = dom.wrapper.classList.contains( 'overview' );
dom.wrapper.classList.add( 'overview' ); dom.wrapper.classList.add( 'overview' );
@ -794,6 +797,8 @@ var Reveal = (function(){
slide( indexh, indexv ); slide( indexh, indexv );
cueAutoSlide();
// Notify observers of the overview hiding // Notify observers of the overview hiding
dispatchEvent( 'overviewhidden', { dispatchEvent( 'overviewhidden', {
'indexh': indexh, 'indexh': indexh,
@ -862,6 +867,7 @@ var Reveal = (function(){
*/ */
function pause() { function pause() {
cancelAutoSlide();
dom.wrapper.classList.add( 'paused' ); dom.wrapper.classList.add( 'paused' );
} }
@ -871,6 +877,7 @@ var Reveal = (function(){
*/ */
function resume() { function resume() {
cueAutoSlide();
dom.wrapper.classList.remove( 'paused' ); dom.wrapper.classList.remove( 'paused' );
} }
@ -1424,12 +1431,21 @@ var Reveal = (function(){
clearTimeout( autoSlideTimeout ); clearTimeout( autoSlideTimeout );
// Cue the next auto-slide if enabled // Cue the next auto-slide if enabled
if( autoSlide ) { if( autoSlide && !isPaused() && !isOverviewActive() ) {
autoSlideTimeout = setTimeout( navigateNext, autoSlide ); autoSlideTimeout = setTimeout( navigateNext, autoSlide );
} }
} }
/**
* Cancels any ongoing request to auto-slide.
*/
function cancelAutoSlide() {
clearTimeout( autoSlideTimeout );
}
function navigateLeft() { function navigateLeft() {
// Prioritize hiding fragments // Prioritize hiding fragments

4
js/reveal.min.js vendored

File diff suppressed because one or more lines are too long