Commit c7c2b2a2 authored by campaign's avatar campaign

属性深度复制

parent 7fcb5d76
...@@ -189,7 +189,9 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", { ...@@ -189,7 +189,9 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
}, },
clone:function(){ clone:function(){
function cloneNode(parent,isClonedNode){ function cloneNode(parent,isClonedNode){
var _tmp = new KM.MinderNode(isClonedNode.getData()); var _tmp = new KM.MinderNode();
_tmp.data = utils.clonePlainObject(isClonedNode.getData());
_tmp.parent = parent; _tmp.parent = parent;
if(parent){ if(parent){
parent.children.push(_tmp); parent.children.push(_tmp);
......
...@@ -117,7 +117,7 @@ var utils = Utils = KityMinder.Utils = { ...@@ -117,7 +117,7 @@ var utils = Utils = KityMinder.Utils = {
tmp = source[i]; tmp = source[i];
if (utils.isObject(tmp) || utils.isArray(tmp)) { if (utils.isObject(tmp) || utils.isArray(tmp)) {
target[i] = utils.isArray(tmp) ? [] : {}; target[i] = utils.isArray(tmp) ? [] : {};
utils.clone(source[i], target[i]) utils.clonePlainObject(source[i], target[i])
} else { } else {
target[i] = tmp; target[i] = tmp;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment