added stage.reset() method so that you can reset the stage to its original state. hooked this in with stage.load() so that the stage starts when a clean slate when loading json

This commit is contained in:
Eric Rowell
2012-04-28 13:57:43 -07:00
parent 9cc380608e
commit bd17b54aa8
5 changed files with 19 additions and 5 deletions

View File

@@ -42,6 +42,9 @@ Kinetic.Layer.prototype = {
if(timeDiff >= throttle) {
this._draw();
this.lastDrawTime = time;
if(this.drawTimeout !== undefined) {
clearTimeout(this.drawTimeout);
}
}
/*
* if we cannot draw the layer due to throttling,

View File

@@ -241,6 +241,8 @@ Kinetic.Stage.prototype = {
* @param {String} JSON string
*/
load: function(json) {
this.reset();
function loadNode(node, obj) {
var children = obj.children;
if(children !== undefined) {