auto-slide playback updates, fix tap action, hide during overview

This commit is contained in:
Hakim El Hattab 2013-10-13 15:06:30 -04:00
parent abf33e55b0
commit 6aaf88aae7
4 changed files with 59 additions and 48 deletions

View File

@ -1562,6 +1562,16 @@ body {
bottom: 15px; bottom: 15px;
z-index: 30; z-index: 30;
cursor: pointer; cursor: pointer;
-webkit-transition: all 400ms ease;
-moz-transition: all 400ms ease;
-ms-transition: all 400ms ease;
transition: all 400ms ease;
}
.reveal.overview .playback {
opacity: 0;
visibility:
} }

2
css/reveal.min.css vendored

File diff suppressed because one or more lines are too long

View File

@ -69,7 +69,7 @@ var Reveal = (function(){
autoSlide: 0, autoSlide: 0,
// Stop auto-sliding after user input // Stop auto-sliding after user input
autoSlideStoppable: false, autoSlideStoppable: true,
// Enable slide navigation via mouse wheel // Enable slide navigation via mouse wheel
mouseWheel: false, mouseWheel: false,
@ -1610,16 +1610,6 @@ var Reveal = (function(){
// Update the URL hash // Update the URL hash
writeURL(); writeURL();
// If the current slide has a data-autoslide use that,
// otherwise use the config.autoSlide value
var slideAutoSlide = currentSlide.getAttribute( 'data-autoslide' );
if( slideAutoSlide ) {
autoSlide = parseInt( slideAutoSlide, 10 );
}
else {
autoSlide = config.autoSlide;
}
cueAutoSlide(); cueAutoSlide();
} }
@ -2258,23 +2248,35 @@ var Reveal = (function(){
*/ */
function cueAutoSlide() { function cueAutoSlide() {
clearTimeout( autoSlideTimeout ); cancelAutoSlide();
autoSlideTimeout = -1;
autoSlideStartTime = Date.now(); if( currentSlide ) {
// Cue the next auto-slide if: // If the current slide has a data-autoslide use that,
// - There is an autoSlide value // otherwise use the config.autoSlide value
// - Auto-sliding isn't paused by the user var slideAutoSlide = currentSlide.getAttribute( 'data-autoslide' );
// - The presentation isn't paused if( slideAutoSlide ) {
// - The overview isn't active autoSlide = parseInt( slideAutoSlide, 10 );
// - The presentation isn't over }
if( autoSlide && !autoSlidePaused && !isPaused() && !isOverview() && ( !Reveal.isLastSlide() || config.loop === true ) ) { else {
autoSlideTimeout = setTimeout( navigateNext, autoSlide ); autoSlide = config.autoSlide;
} }
// Cue the next auto-slide if:
// - There is an autoSlide value
// - Auto-sliding isn't paused by the user
// - The presentation isn't paused
// - The overview isn't active
// - The presentation isn't over
if( autoSlide && !autoSlidePaused && !isPaused() && !isOverview() && ( !Reveal.isLastSlide() || config.loop === true ) ) {
autoSlideTimeout = setTimeout( navigateNext, autoSlide );
autoSlideStartTime = Date.now();
}
if( autoSlidePlayer ) {
autoSlidePlayer.setPlaying( autoSlideTimeout !== -1 );
}
if( autoSlidePlayer ) {
autoSlidePlayer.setPlaying( autoSlideTimeout !== -1 );
} }
} }
@ -2285,6 +2287,7 @@ var Reveal = (function(){
function cancelAutoSlide() { function cancelAutoSlide() {
clearTimeout( autoSlideTimeout ); clearTimeout( autoSlideTimeout );
autoSlideTimeout = -1;
} }
@ -2530,8 +2533,6 @@ var Reveal = (function(){
*/ */
function onTouchStart( event ) { function onTouchStart( event ) {
onUserInput( event );
touch.startX = event.touches[0].clientX; touch.startX = event.touches[0].clientX;
touch.startY = event.touches[0].clientY; touch.startY = event.touches[0].clientY;
touch.startCount = event.touches.length; touch.startCount = event.touches.length;
@ -2557,6 +2558,8 @@ var Reveal = (function(){
// Each touch should only trigger one action // Each touch should only trigger one action
if( !touch.captured ) { if( !touch.captured ) {
onUserInput( event );
var currentX = event.touches[0].clientX; var currentX = event.touches[0].clientX;
var currentY = event.touches[0].clientY; var currentY = event.touches[0].clientY;
@ -2852,29 +2855,25 @@ var Reveal = (function(){
// Start repainting if we're playing // Start repainting if we're playing
if( this.playing ) { if( this.playing ) {
this.update(); this.animate();
} }
}; };
Playback.prototype.setProgress = function( value ) { Playback.prototype.animate = function() {
this.progress = value;
this.render();
};
Playback.prototype.update = function() {
this.progress = this.progressCheck(); this.progress = this.progressCheck();
this.render(); this.render();
if( this.playing ) { if( this.playing ) {
window.requestAnimationFrame( this.update.bind( this ) ); window.requestAnimationFrame( this.animate.bind( this ) );
} }
}; };
/**
* Renders the current progress and playback state.
*/
Playback.prototype.render = function() { Playback.prototype.render = function() {
var progress = this.playing ? this.progress : 0; var progress = this.playing ? this.progress : 0;
@ -2933,14 +2932,6 @@ var Reveal = (function(){
}; };
Playback.prototype.destroy = function() {
if( this.canvas.parentNode ) {
this.container.removeChild( this.canvas );
}
};
Playback.prototype.on = function( type, listener ) { Playback.prototype.on = function( type, listener ) {
this.canvas.addEventListener( type, listener, false ); this.canvas.addEventListener( type, listener, false );
}; };
@ -2949,6 +2940,16 @@ var Reveal = (function(){
this.canvas.removeEventListener( type, listener, false ); this.canvas.removeEventListener( type, listener, false );
}; };
Playback.prototype.destroy = function() {
this.playing = false;
if( this.canvas.parentNode ) {
this.container.removeChild( this.canvas );
}
};
// --------------------------------------------------------------------// // --------------------------------------------------------------------//
// ------------------------------- API --------------------------------// // ------------------------------- API --------------------------------//

4
js/reveal.min.js vendored

File diff suppressed because one or more lines are too long