aboutsummaryrefslogtreecommitdiffstats
path: root/src/fx.js
diff options
context:
space:
mode:
authorRémi Tétreault <tetreault.remi@gmail.com>2017-03-05 20:55:09 -0500
committerRémi Tétreault <tetreault.remi@gmail.com>2017-03-07 20:44:58 -0500
commit9165ee80eca0be42970ccbc5470f5541f206f7f3 (patch)
tree5edc0e305ce082ab91b1bffa0d78ae7047a2be21 /src/fx.js
parent927aeaeafa4e3bf21390b86f1a5087b49558db49 (diff)
downloadsvg.js-9165ee80eca0be42970ccbc5470f5541f206f7f3.tar.gz
svg.js-9165ee80eca0be42970ccbc5470f5541f206f7f3.zip
Make the method dequeue stop the current animation
There was a bug in the dequeue method of the FX module. It was not stopping the current animation as it was supposed too. This bug is now fixed. Also, I rewritten the test that @fuzzyma left commented. I changed its implementation to not use the once callback since there seem to be some issues when combining once and dequeue. The method stop was also modified, it now call start only when it's revelant.
Diffstat (limited to 'src/fx.js')
-rw-r--r--src/fx.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/fx.js b/src/fx.js
index fd343e0..157c4f9 100644
--- a/src/fx.js
+++ b/src/fx.js
@@ -194,14 +194,14 @@ SVG.FX = SVG.invent({
*/
, dequeue: function(){
// stop current animation
- this.situation && this.situation.stop && this.situation.stop()
+ this.stop()
// get next animation from queue
this.situation = this.situations.shift()
if(this.situation){
if(this.situation instanceof SVG.Situation) {
- this.startCurrent()
+ this.start()
} else {
// If it is not a SVG.Situation, then it is a function, we execute it
this.situation.call(this)
@@ -257,15 +257,16 @@ SVG.FX = SVG.invent({
* @return this
*/
, stop: function(jumpToEnd, clearQueue){
- if(!this.active) this.start()
+ var active = this.active
+ this.active = false
if(clearQueue){
this.clearQueue()
}
- this.active = false
-
if(jumpToEnd && this.situation){
+ // initialize the situation if it was not
+ !active && this.startCurrent()
this.atEnd()
}