mirror of
https://github.com/konvajs/konva.git
synced 2025-12-05 03:24:23 +08:00
fixed small bug related to animations - if you called .start() multiple times, multiple animation instances would be created. This wasn't desirable. Also beefed up animation unit tests
This commit is contained in:
12
src/Stage.js
12
src/Stage.js
@@ -67,9 +67,12 @@ Kinetic.Stage.prototype = {
|
||||
* start animation
|
||||
*/
|
||||
start: function() {
|
||||
var go = Kinetic.GlobalObject;
|
||||
go._addAnimation(this.anim);
|
||||
go._handleAnimation();
|
||||
if(!this.animRunning) {
|
||||
var go = Kinetic.GlobalObject;
|
||||
go._addAnimation(this.anim);
|
||||
go._handleAnimation();
|
||||
this.animRunning = true;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* stop animation
|
||||
@@ -77,7 +80,7 @@ Kinetic.Stage.prototype = {
|
||||
stop: function() {
|
||||
var go = Kinetic.GlobalObject;
|
||||
go._removeAnimation(this.anim);
|
||||
go._handleAnimation();
|
||||
this.animRunning = false;
|
||||
},
|
||||
/**
|
||||
* draw children
|
||||
@@ -910,6 +913,7 @@ Kinetic.Stage.prototype = {
|
||||
this.ids = {};
|
||||
this.names = {};
|
||||
this.anim = undefined;
|
||||
this.animRunning = false;
|
||||
}
|
||||
};
|
||||
// Extend Container and Node
|
||||
|
||||
Reference in New Issue
Block a user