add api methods for check if overview is active or presentation is paused
This commit is contained in:
parent
2962325fd1
commit
24c493fb83
28
js/reveal.js
28
js/reveal.js
|
@ -822,7 +822,7 @@ var Reveal = (function(){
|
||||||
override ? activateOverview() : deactivateOverview();
|
override ? activateOverview() : deactivateOverview();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
isOverviewActive() ? deactivateOverview() : activateOverview();
|
isOverview() ? deactivateOverview() : activateOverview();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -833,7 +833,7 @@ var Reveal = (function(){
|
||||||
* @return {Boolean} true if the overview is active,
|
* @return {Boolean} true if the overview is active,
|
||||||
* false otherwise
|
* false otherwise
|
||||||
*/
|
*/
|
||||||
function isOverviewActive() {
|
function isOverview() {
|
||||||
|
|
||||||
return dom.wrapper.classList.contains( 'overview' );
|
return dom.wrapper.classList.contains( 'overview' );
|
||||||
|
|
||||||
|
@ -973,7 +973,7 @@ var Reveal = (function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the overview is active, re-activate it to update positions
|
// If the overview is active, re-activate it to update positions
|
||||||
if( isOverviewActive() ) {
|
if( isOverview() ) {
|
||||||
activateOverview();
|
activateOverview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1084,7 +1084,7 @@ var Reveal = (function(){
|
||||||
|
|
||||||
// Optimization; hide all slides that are three or more steps
|
// Optimization; hide all slides that are three or more steps
|
||||||
// away from the present slide
|
// away from the present slide
|
||||||
if( isOverviewActive() === false ) {
|
if( isOverview() === false ) {
|
||||||
// The distance loops so that it measures 1 between the first
|
// The distance loops so that it measures 1 between the first
|
||||||
// and last slides
|
// and last slides
|
||||||
var distance = Math.abs( ( index - i ) % ( slidesLength - 3 ) ) || 0;
|
var distance = Math.abs( ( index - i ) % ( slidesLength - 3 ) ) || 0;
|
||||||
|
@ -1431,7 +1431,7 @@ var Reveal = (function(){
|
||||||
clearTimeout( autoSlideTimeout );
|
clearTimeout( autoSlideTimeout );
|
||||||
|
|
||||||
// Cue the next auto-slide if enabled
|
// Cue the next auto-slide if enabled
|
||||||
if( autoSlide && !isPaused() && !isOverviewActive() ) {
|
if( autoSlide && !isPaused() && !isOverview() ) {
|
||||||
autoSlideTimeout = setTimeout( navigateNext, autoSlide );
|
autoSlideTimeout = setTimeout( navigateNext, autoSlide );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1449,7 +1449,7 @@ var Reveal = (function(){
|
||||||
function navigateLeft() {
|
function navigateLeft() {
|
||||||
|
|
||||||
// Prioritize hiding fragments
|
// Prioritize hiding fragments
|
||||||
if( availableRoutes().left && isOverviewActive() || previousFragment() === false ) {
|
if( availableRoutes().left && isOverview() || previousFragment() === false ) {
|
||||||
slide( indexh - 1 );
|
slide( indexh - 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1458,7 +1458,7 @@ var Reveal = (function(){
|
||||||
function navigateRight() {
|
function navigateRight() {
|
||||||
|
|
||||||
// Prioritize revealing fragments
|
// Prioritize revealing fragments
|
||||||
if( availableRoutes().right && isOverviewActive() || nextFragment() === false ) {
|
if( availableRoutes().right && isOverview() || nextFragment() === false ) {
|
||||||
slide( indexh + 1 );
|
slide( indexh + 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1467,7 +1467,7 @@ var Reveal = (function(){
|
||||||
function navigateUp() {
|
function navigateUp() {
|
||||||
|
|
||||||
// Prioritize hiding fragments
|
// Prioritize hiding fragments
|
||||||
if( availableRoutes().up && isOverviewActive() || previousFragment() === false ) {
|
if( availableRoutes().up && isOverview() || previousFragment() === false ) {
|
||||||
slide( indexh, indexv - 1 );
|
slide( indexh, indexv - 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1476,7 +1476,7 @@ var Reveal = (function(){
|
||||||
function navigateDown() {
|
function navigateDown() {
|
||||||
|
|
||||||
// Prioritize revealing fragments
|
// Prioritize revealing fragments
|
||||||
if( availableRoutes().down && isOverviewActive() || nextFragment() === false ) {
|
if( availableRoutes().down && isOverview() || nextFragment() === false ) {
|
||||||
slide( indexh, indexv + 1 );
|
slide( indexh, indexv + 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1572,9 +1572,9 @@ var Reveal = (function(){
|
||||||
// end
|
// end
|
||||||
case 35: slide( Number.MAX_VALUE ); break;
|
case 35: slide( Number.MAX_VALUE ); break;
|
||||||
// space
|
// space
|
||||||
case 32: isOverviewActive() ? deactivateOverview() : navigateNext(); break;
|
case 32: isOverview() ? deactivateOverview() : navigateNext(); break;
|
||||||
// return
|
// return
|
||||||
case 13: isOverviewActive() ? deactivateOverview() : triggered = false; break;
|
case 13: isOverview() ? deactivateOverview() : triggered = false; break;
|
||||||
// b, period, Logitech presenter tools "black screen" button
|
// b, period, Logitech presenter tools "black screen" button
|
||||||
case 66: case 190: case 191: togglePause(); break;
|
case 66: case 190: case 191: togglePause(); break;
|
||||||
// f
|
// f
|
||||||
|
@ -1779,7 +1779,7 @@ var Reveal = (function(){
|
||||||
|
|
||||||
// TODO There's a bug here where the event listeners are not
|
// TODO There's a bug here where the event listeners are not
|
||||||
// removed after deactivating the overview.
|
// removed after deactivating the overview.
|
||||||
if( isOverviewActive() ) {
|
if( isOverview() ) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
deactivateOverview();
|
deactivateOverview();
|
||||||
|
@ -1838,6 +1838,10 @@ var Reveal = (function(){
|
||||||
// Toggles the "black screen" mode on/off
|
// Toggles the "black screen" mode on/off
|
||||||
togglePause: togglePause,
|
togglePause: togglePause,
|
||||||
|
|
||||||
|
// State checks
|
||||||
|
isOverview: isOverview,
|
||||||
|
isPaused: isPaused,
|
||||||
|
|
||||||
// Adds or removes all internal event listeners (such as keyboard)
|
// Adds or removes all internal event listeners (such as keyboard)
|
||||||
addEventListeners: addEventListeners,
|
addEventListeners: addEventListeners,
|
||||||
removeEventListeners: removeEventListeners,
|
removeEventListeners: removeEventListeners,
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue