mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
finished custom shape serialization with new attrs structure
This commit is contained in:
@@ -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';
|
||||
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user