Copy and Paste of nodes was not working. Fixed.

This commit is contained in:
Paulo Gustavo Veiga 2013-01-31 15:44:43 -03:00
parent 82ff47220d
commit 7a401b648e
2 changed files with 7 additions and 0 deletions

View File

@ -270,6 +270,11 @@ mindplot.CommandContext = new Class({
return mindmap.createNode(mindplot.NodeModel.MAIN_TOPIC_TYPE); return mindmap.createNode(mindplot.NodeModel.MAIN_TOPIC_TYPE);
}, },
addTopic:function (topic) {
var mindmap = this._designer.getMindmap();
return mindmap.addBranch(topic.getModel());
},
connect:function (childTopic, parentTopic) { connect:function (childTopic, parentTopic) {
childTopic.connectTo(parentTopic, this._designer._workspace); childTopic.connectTo(parentTopic, this._designer._workspace);
}, },

View File

@ -41,6 +41,8 @@ mindplot.commands.AddTopicCommand = new Class({
var parentTopic = commandContext.findTopics(parentId)[0]; var parentTopic = commandContext.findTopics(parentId)[0];
commandContext.connect(topic, parentTopic); commandContext.connect(topic, parentTopic);
} }
}else {
commandContext.addTopic(topic);
} }
// Select just created node ... // Select just created node ...