From 2ec9e70245475415b177a071094e2fae15ed7442 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sat, 17 Nov 2012 12:23:24 -0300 Subject: [PATCH] Relationship source position during drag is not positioned in the center anymore. --- mindplot/src/main/javascript/RelationshipPivot.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mindplot/src/main/javascript/RelationshipPivot.js b/mindplot/src/main/javascript/RelationshipPivot.js index 3b9e0e66..d8cbe769 100644 --- a/mindplot/src/main/javascript/RelationshipPivot.js +++ b/mindplot/src/main/javascript/RelationshipPivot.js @@ -99,8 +99,18 @@ mindplot.RelationshipPivot = new Class({ var pos = screen.getWorkspaceMousePosition(event); // Leave the arrow a couple of pixels away from the cursor. - var gapDistance = Math.sign(pos.x - this._sourceTopic.getPosition().x) * 5; + var sourcePosition = this._sourceTopic.getPosition(); + var gapDistance = Math.sign(pos.x - sourcePosition.x) * 5; + // Calculate origin position ... + var controPoint = mindplot.util.Shape.calculateDefaultControlPoints(sourcePosition, pos); + var spoint = new core.Point(); + spoint.x = parseInt(controPoint[0].x) + parseInt(sourcePosition.x); + spoint.y = parseInt(controPoint[0].y) + parseInt(sourcePosition.y); + var sPos = mindplot.util.Shape.calculateRelationShipPointCoordinates(this._sourceTopic, spoint); + this._pivot.setFrom(sPos.x, sPos.y); + + // Update target position ... this._pivot.setTo(pos.x - gapDistance, pos.y); var controlPoints = this._pivot.getControlPoints();