fixing relationship lines

This commit is contained in:
Pablo Luna 2011-04-17 10:32:08 +01:00
parent f73737ed0b
commit 5d911efa70
3 changed files with 4 additions and 2 deletions

View File

@ -269,7 +269,7 @@ core.Utils.calculateDefaultControlPoints = function(srcPos, tarPos){
var x2 = tarPos.x + Math.sqrt(l*l/(1+(m*m)))*fix*-1;
var y2= m*(x2-tarPos.x)+tarPos.y;
return [new core.Point(srcPos.x - x1,srcPos.y - y1),new core.Point(tarPos.x - x2,tarPos.y - y2)];
return [new core.Point(-srcPos.x + x1,-srcPos.y + y1),new core.Point(-tarPos.x + x2,-tarPos.y + y2)];
};
core.Utils.setVisibilityAnimated = function(elems, isVisible, doneFn){

View File

@ -280,6 +280,7 @@ mindplot.MindmapDesigner.prototype.addRelationShip2SelectedNode = function(event
var selectedTopics = this.getSelectedNodes();
if(selectedTopics.length >0 &&
(!core.Utils.isDefined(this._creatingRelationship) || (core.Utils.isDefined(this._creatingRelationship) && !this._creatingRelationship))){
this._workspace.enableWorkspaceEvents(false);
var fromNodePosition = selectedTopics[0].getPosition();
this._relationship = new web2d.CurvedLine();
this._relationship.setStyle(web2d.CurvedLine.SIMPLE_LINE);
@ -318,6 +319,7 @@ mindplot.MindmapDesigner.prototype._relationshipMouseClick = function (event, fr
this._workspace.getScreenManager().removeEventListener('mousemove',this._relationshipMouseMoveFunction);
this._workspace.getScreenManager().removeEventListener('click',this._relationshipMouseClickFunction);
this._creatingRelationship=false;
this._workspace.enableWorkspaceEvents(true);
event.preventDefault();
event.stop();
return false;

View File

@ -67,7 +67,7 @@ mindplot.RelationshipLine.prototype.redraw = function()
var sPos,tPos;
this._line2d.setStroke(2);
var ctrlPoints = this._line2d.getControlPoints();
if(!core.Utils.isDefined(ctrlPoints[0].x) || !core.Utils.isDefined(ctrlPoints[1].x)){
if(!this._line2d.isDestControlPointCustom() && !this._line2d.isSrcControlPointCustom()){
var defaultPoints = core.Utils.calculateDefaultControlPoints(sourcePosition, targetPosition);
ctrlPoints[0].x=defaultPoints[0].x;
ctrlPoints[0].y=defaultPoints[0].y;