Support connection in any node.

This commit is contained in:
Paulo Veiga
2011-09-14 08:51:38 -03:00
parent 5a08728686
commit 304f9f4c97
6 changed files with 41 additions and 27 deletions

View File

@@ -25,25 +25,25 @@ mindplot.MainTopic = new Class({
INNER_RECT_ATTRIBUTES : {stroke:'0.5 solid #009900'},
createSiblingModel : function(positionate) {
var siblingModel = null;
var result = null;
var parentTopic = this.getOutgoingConnectedTopic();
if (parentTopic != null) {
// Create a new node ...
var model = this.getModel();
var mindmap = model.getMindmap();
siblingModel = mindmap.createNode(mindplot.model.INodeModel.MAIN_TOPIC_TYPE);
result = mindmap.createNode(mindplot.model.INodeModel.MAIN_TOPIC_TYPE);
// Positionate following taking into account the sibling positon.
// Positionate following taking into account the sibling position.
if (positionate && parentTopic.getType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
var pos = this.getPosition();
siblingModel.setPosition(pos.x, pos.y);
result.setPosition(pos.x, pos.y);
}
// Create a new node ...
var order = this.getOrder() + 1;
siblingModel.setOrder(order);
result.setOrder(order);
}
return siblingModel;
return result;
},
createChildModel : function(prepositionate) {