diff options
author | Marco Cecchetti <mrcekets@gmail.com> | 2012-07-04 18:50:46 +0200 |
---|---|---|
committer | Marco Cecchetti <mrcekets@gmail.com> | 2012-07-15 11:51:46 +0200 |
commit | aaed0c6e4953941c232cb17fcedda92635ec5905 (patch) | |
tree | 16ce10e6391b47669fa5d3778da0a4ff35b38988 /filter | |
parent | 9a786c8a1b76277e1926b19de9fc5732ae183a02 (diff) |
Provided support for rewinding to the previous slide and for skipping / rewinding all effects.
The following method of the SlideShow class has been implemented:
skipAllEffects, rewindToPreviousSlide, rewindAllEffects.
Commented out the calls to the initAnimatedElement methods for ValueListActivity and
FromToByActivity class as it is the source of a bug.
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/svg/presentation_engine.js | 151 |
1 files changed, 118 insertions, 33 deletions
diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js index 2e665615f1b8..f04226390e1d 100644 --- a/filter/source/svg/presentation_engine.js +++ b/filter/source/svg/presentation_engine.js @@ -150,13 +150,13 @@ function getDefaultKeyCodeDictionary() keyCodeDict[SLIDE_MODE][RIGHT_KEY] = function() { return dispatchEffects(1); }; keyCodeDict[SLIDE_MODE][UP_KEY] - = function() { return skipEffects(-1); }; + = function() { return aSlideShow.rewindEffect(); }; keyCodeDict[SLIDE_MODE][DOWN_KEY] = function() { return skipEffects(1); }; keyCodeDict[SLIDE_MODE][PAGE_UP_KEY] - = function() { return switchSlide( -1, true ); }; + = function() { return aSlideShow.rewindAllEffects(); }; keyCodeDict[SLIDE_MODE][PAGE_DOWN_KEY] - = function() { return switchSlide( 1, true ); }; + = function() { return skipAllEffects(); }; keyCodeDict[SLIDE_MODE][HOME_KEY] = function() { return aSlideShow.displaySlide( 0, true ); }; keyCodeDict[SLIDE_MODE][END_KEY] @@ -1433,7 +1433,7 @@ var NAVDBG = new DebugPrinter(); NAVDBG.off(); var ANIMDBG = new DebugPrinter(); -ANIMDBG.off(); +ANIMDBG.on(); var aRegisterEventDebugPrinter = new DebugPrinter(); aRegisterEventDebugPrinter.off(); @@ -2985,6 +2985,15 @@ function dispatchEffects(dir) } } +function skipAllEffects() +{ + var bRet = aSlideShow.skipAllEffects(); + if( !bRet ) + { + switchSlide( 1, true ); + } +} + function skipEffects(dir) { if( dir == 1 ) @@ -2993,12 +3002,12 @@ function skipEffects(dir) if( !bRet ) { - switchSlide( 1, false ); + switchSlide( 1, true ); } } else { - switchSlide( dir, false ); + switchSlide( dir, true ); } } @@ -10725,7 +10734,7 @@ function FromToByActivityTemplate( BaseType ) // template parameter this.nIteration = 0; this.bCumulative = bAccumulate; - this.initAnimatedElement(); + //this.initAnimatedElement(); } extend( FromToByActivity, BaseType ); @@ -10931,7 +10940,7 @@ function ValueListActivityTemplate( BaseType ) // template parameter this.bCumulative = bAccumulate; this.aLastValue = this.aValueList[ this.aValueList.length - 1 ]; - this.initAnimatedElement(); + //this.initAnimatedElement(); } extend( ValueListActivity, BaseType ); @@ -10943,7 +10952,7 @@ function ValueListActivityTemplate( BaseType ) // template parameter ANIMDBG.print( 'createValueListActivity: value[' + i + '] = ' + this.aValueList[i] ); } - this.initAnimatedElement(); + //this.initAnimatedElement(); }; ValueListActivity.prototype.initAnimatedElement = function() @@ -11283,6 +11292,7 @@ function SlideShow() this.bIsEnabled = true; this.bIsRewinding = false; this.bIsSkipping = false; + this.bIsSkippingAll = false; this.bNoSlideTransition = false; } @@ -11422,30 +11432,6 @@ SlideShow.prototype.skipCurrentEffect = function() this.bIsSkipping = false; }; -/** rewindEffect - * Rewind the current playing effect or the last played one. - * - */ -SlideShow.prototype.rewindEffect = function() -{ - if( this.bIsSkipping || this.bIsRewinding ) - return true; - - this.bIsRewinding = true; - if( this.isRunning() ) - { - this.aEventMultiplexer.notifyRewindCurrentEffectEvent(); - } - else - { - this.aEventMultiplexer.notifyRewindLastEffectEvent(); - } - if( this.nCurrentEffect > 0 ) - --this.nCurrentEffect; - this.update(); - this.bIsRewinding = false; -}; - /** skipEffect * Skip the next effect to be played. * @@ -11478,6 +11464,105 @@ SlideShow.prototype.skipEffect = function() return true; }; +/** skipAllEffects + * Skip all left effects on the current slide. + * + * @return {Boolean} + * True if it already skipping or when it has ended skipping, + * false if the next slide needs to be displayed. + */ +SlideShow.prototype.skipAllEffects = function() +{ + if( this.bIsSkippingAll ) + return true; + + this.bIsSkippingAll = true; + if( this.isRunning() ) + { + this.skipCurrentEffect(); + } + else if( !this.aNextEffectEventArray + || ( this.nCurrentEffect >= this.aNextEffectEventArray.size() ) ) + { + this.bIsSkippingAll = false; + return false; + } + + // Pay attention here: a new next effect event is appended to + // aNextEffectEventArray only after the related animation node has been + // resolved, that is only after the animation node related to the previous + // effect has notified to be deactivated to the main sequence time container. + // So you should avoid any optimization here because the size of + // aNextEffectEventArray will going on increasing after every skip action. + while( this.nCurrentEffect < this.aNextEffectEventArray.size() ) + { + this.skipEffect(); + } + this.bIsSkippingAll = false; + return true; +}; + +/** rewindEffect + * Rewind the current playing effect or the last played one. + * + */ +SlideShow.prototype.rewindEffect = function() +{ + if( this.bIsSkipping || this.bIsRewinding ) + return; + + if( this.nCurrentEffect == 0 ) + { + this.rewindToPreviousSlide(); + return; + } + + this.bIsRewinding = true; + if( this.isRunning() ) + { + this.aEventMultiplexer.notifyRewindCurrentEffectEvent(); + } + else + { + this.aEventMultiplexer.notifyRewindLastEffectEvent(); + } + if( this.nCurrentEffect > 0 ) + --this.nCurrentEffect; + this.update(); + this.bIsRewinding = false; +}; + +/** rewindToPreviousSlide + * Displays the previous slide with all effects played. + * + */ +SlideShow.prototype.rewindToPreviousSlide = function() +{ + if( this.isRunning() ) + return; + var nNewSlide = nCurSlide - 1; + this.displaySlide( nNewSlide, true ); + this.skipAllEffects(); +}; + +/** rewindAllEffects + * Rewind all effects already played on the current slide. + * + */ +SlideShow.prototype.rewindAllEffects = function() +{ + if( this.nCurrentEffect == 0 ) + { + this.rewindToPreviousSlide(); + return; + } + + while( this.nCurrentEffect > 0 ) + { + this.rewindEffect(); + } +}; + SlideShow.prototype.displaySlide = function( nNewSlide, bSkipSlideTransition ) { var aMetaDoc = theMetaDoc; |