auto-slide playback updates, fix tap action, hide during overview
This commit is contained in:
parent
abf33e55b0
commit
6aaf88aae7
4 changed files with 59 additions and 48 deletions
|
@ -1562,6 +1562,16 @@ body {
|
|||
bottom: 15px;
|
||||
z-index: 30;
|
||||
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
2
css/reveal.min.css
vendored
File diff suppressed because one or more lines are too long
69
js/reveal.js
69
js/reveal.js
|
@ -69,7 +69,7 @@ var Reveal = (function(){
|
|||
autoSlide: 0,
|
||||
|
||||
// Stop auto-sliding after user input
|
||||
autoSlideStoppable: false,
|
||||
autoSlideStoppable: true,
|
||||
|
||||
// Enable slide navigation via mouse wheel
|
||||
mouseWheel: false,
|
||||
|
@ -1610,16 +1610,6 @@ var Reveal = (function(){
|
|||
// Update the URL hash
|
||||
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();
|
||||
|
||||
}
|
||||
|
@ -2258,10 +2248,19 @@ var Reveal = (function(){
|
|||
*/
|
||||
function cueAutoSlide() {
|
||||
|
||||
clearTimeout( autoSlideTimeout );
|
||||
autoSlideTimeout = -1;
|
||||
cancelAutoSlide();
|
||||
|
||||
autoSlideStartTime = Date.now();
|
||||
if( currentSlide ) {
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Cue the next auto-slide if:
|
||||
// - There is an autoSlide value
|
||||
|
@ -2271,6 +2270,7 @@ var Reveal = (function(){
|
|||
// - The presentation isn't over
|
||||
if( autoSlide && !autoSlidePaused && !isPaused() && !isOverview() && ( !Reveal.isLastSlide() || config.loop === true ) ) {
|
||||
autoSlideTimeout = setTimeout( navigateNext, autoSlide );
|
||||
autoSlideStartTime = Date.now();
|
||||
}
|
||||
|
||||
if( autoSlidePlayer ) {
|
||||
|
@ -2279,12 +2279,15 @@ var Reveal = (function(){
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels any ongoing request to auto-slide.
|
||||
*/
|
||||
function cancelAutoSlide() {
|
||||
|
||||
clearTimeout( autoSlideTimeout );
|
||||
autoSlideTimeout = -1;
|
||||
|
||||
}
|
||||
|
||||
|
@ -2530,8 +2533,6 @@ var Reveal = (function(){
|
|||
*/
|
||||
function onTouchStart( event ) {
|
||||
|
||||
onUserInput( event );
|
||||
|
||||
touch.startX = event.touches[0].clientX;
|
||||
touch.startY = event.touches[0].clientY;
|
||||
touch.startCount = event.touches.length;
|
||||
|
@ -2557,6 +2558,8 @@ var Reveal = (function(){
|
|||
|
||||
// Each touch should only trigger one action
|
||||
if( !touch.captured ) {
|
||||
onUserInput( event );
|
||||
|
||||
var currentX = event.touches[0].clientX;
|
||||
var currentY = event.touches[0].clientY;
|
||||
|
||||
|
@ -2852,29 +2855,25 @@ var Reveal = (function(){
|
|||
|
||||
// Start repainting if we're playing
|
||||
if( this.playing ) {
|
||||
this.update();
|
||||
this.animate();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Playback.prototype.setProgress = function( value ) {
|
||||
|
||||
this.progress = value;
|
||||
this.render();
|
||||
|
||||
};
|
||||
|
||||
Playback.prototype.update = function() {
|
||||
Playback.prototype.animate = function() {
|
||||
|
||||
this.progress = this.progressCheck();
|
||||
this.render();
|
||||
|
||||
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() {
|
||||
|
||||
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 ) {
|
||||
this.canvas.addEventListener( type, listener, false );
|
||||
};
|
||||
|
@ -2949,6 +2940,16 @@ var Reveal = (function(){
|
|||
this.canvas.removeEventListener( type, listener, false );
|
||||
};
|
||||
|
||||
Playback.prototype.destroy = function() {
|
||||
|
||||
this.playing = false;
|
||||
|
||||
if( this.canvas.parentNode ) {
|
||||
this.container.removeChild( this.canvas );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// --------------------------------------------------------------------//
|
||||
// ------------------------------- API --------------------------------//
|
||||
|
|
4
js/reveal.min.js
vendored
4
js/reveal.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue