From 09d57bfc031a379bc5dda2881dd7de1eac4ce056 Mon Sep 17 00:00:00 2001 From: Pablo Luna Date: Sun, 13 Mar 2011 14:34:36 +0000 Subject: [PATCH] improving nodes connection detection --- mindplot/src/main/javascript/NodeModel.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mindplot/src/main/javascript/NodeModel.js b/mindplot/src/main/javascript/NodeModel.js index 7e0fa9aa..337cda82 100644 --- a/mindplot/src/main/javascript/NodeModel.js +++ b/mindplot/src/main/javascript/NodeModel.js @@ -278,7 +278,7 @@ mindplot.NodeModel.prototype.canBeConnected = function(sourceModel, sourcePositi var targetTopicSize = targetModel.getSize(); var yDistance = Math.abs(sourcePosition.y - targetPosition.y); - if (yDistance <= targetTopicHeight / 2) + if (yDistance <= 5 + targetTopicHeight / 2) { // Circular connection ? if (!sourceModel._isChildNode(this)) @@ -290,14 +290,14 @@ mindplot.NodeModel.prototype.canBeConnected = function(sourceModel, sourcePositi if (isTargetAtRightFromCentral) { - if (xDistance >= 0 && xDistance <= mindplot.NodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE + (targetTopicSize.width / 2)) + if (xDistance >= -targetTopicSize.width/2 && xDistance <= mindplot.NodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE /2 + (targetTopicSize.width / 2)) { result = true; } } else { - if (xDistance <= 0 && Math.abs(xDistance) <= mindplot.NodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE + (targetTopicSize.width / 2)) + if (xDistance <= targetTopicSize.width/2 && Math.abs(xDistance) <= mindplot.NodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE /2 + (targetTopicSize.width / 2)) { result = true; }