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

@@ -1121,6 +1121,7 @@ Kinetic.Stage.prototype = {
function addNode(node) {
var obj = {};
obj.attrs = node.attrs;
obj.nodeType = node.nodeType;
obj.shapeType = node.shapeType;
@@ -1145,7 +1146,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;
@@ -1928,11 +1929,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';

File diff suppressed because one or more lines are too long