Merge pull request #32 from boatmeme/11a1662c0e3e8c9bd20db2ac8ff3f2572b337cb7

Calling stage.toJSON() prevents subsequent drawing on existing child layers
This commit is contained in:
ericdrowell
2012-06-21 21:35:01 -07:00

View File

@@ -163,18 +163,16 @@ Kinetic.Stage.prototype = {
function addNode(node) {
var obj = {};
var cleanAttrs = node.attrs;
obj.attrs = {};
// remove function, image, DOM, and objects with methods
for(var key in cleanAttrs) {
var val = cleanAttrs[key];
if(go._isFunction(val) || go._isElement(val) || go._hasMethods(val)) {
cleanAttrs[key] = undefined;
// serialize only attributes that are not function, image, DOM, or objects with methods
for(var key in node.attrs) {
var val = node.attrs[key];
if(!go._isFunction(val) && !go._isElement(val) && !go._hasMethods(val)) {
obj.attrs[key] = val;
}
}
obj.attrs = cleanAttrs;
obj.nodeType = node.nodeType;
obj.shapeType = node.shapeType;