fixed up some issues with serialization and deserialization and updated unit tests

This commit is contained in:
Eric Rowell
2012-05-20 16:42:37 -07:00
parent e26575a6c8
commit 61d325d383
5 changed files with 87 additions and 69 deletions

View File

@@ -27,7 +27,10 @@ Kinetic.Shape = function(config) {
shadow: {
blur: 10,
alpha: 1,
offset: [0, 0]
offset: {
x: 0,
y: 0
}
}
});

View File

@@ -182,7 +182,18 @@ Kinetic.Stage.prototype = {
function addNode(node) {
var obj = {};
obj.attrs = node.attrs;
var cleanAttrs = node.attrs;
// remove function, image, and DOM attrs
for (var key in cleanAttrs) {
var val = cleanAttrs[key];
if (go._isFunction(val) || go._isElement(val)) {
cleanAttrs[key] = undefined;
}
}
obj.attrs = cleanAttrs;
obj.nodeType = node.nodeType;
obj.shapeType = node.shapeType;