finished custom shape serialization with new attrs structure

This commit is contained in:
Eric Rowell
2012-04-07 15:03:19 -07:00
parent 58eb778e9a
commit 1a40e50622
5 changed files with 67 additions and 68 deletions

View File

@@ -25,11 +25,10 @@ Kinetic.Shape = function(config) {
this.attrs.strokeWidth = undefined;
this.attrs.lineJoin = undefined;
this.attrs.detectionType = 'path';
this.attrs.drawFuncName = undefined;
// special
this.drawFunc = config.drawFunc;
this.data = [];
this.nodeType = 'Shape';

View File

@@ -191,6 +191,7 @@ Kinetic.Stage.prototype = {
function addNode(node) {
var obj = {};
obj.attrs = node.attrs;
obj.nodeType = node.nodeType;
obj.shapeType = node.shapeType;
@@ -215,7 +216,7 @@ Kinetic.Stage.prototype = {
function loadNode(node, obj) {
// if custom shape then set draw function
if(obj.nodeType === 'Shape' && obj.shapeType === undefined) {
node.drawFunc = drawFuncs[obj.drawFuncName];
node.drawFunc = drawFuncs[obj.attrs.drawFuncName];
}
var children = obj.children;