Keep simplifing connection algorithm.

This commit is contained in:
Paulo Gustavo Veiga
2012-08-18 23:20:23 -03:00
parent bff79159e1
commit 04fda82ba0
3 changed files with 47 additions and 81 deletions

View File

@@ -95,29 +95,6 @@ mindplot.DragTopic = new Class({
dragPivot.disconnect(workspace);
},
canBeConnectedTo:function (targetTopic) {
$assert(targetTopic, 'parent can not be null');
var result = true;
if (!targetTopic.areChildrenShrunken() && !targetTopic.isCollapsed()) {
// Dragged node can not be connected to himself.
if (targetTopic == this._draggedNode) {
result = false;
} else {
var draggedNode = this.getDraggedTopic();
var topicPosition = this.getPosition();
var targetTopicModel = targetTopic.getModel();
var childTopicModel = draggedNode.getModel();
result = targetTopicModel.canBeConnected(childTopicModel, topicPosition, targetTopic.getSize());
}
} else {
result = false;
}
return result;
},
connectTo:function (parent) {
$assert(parent, 'Parent connection node can not be null.');