fixing arrows and curved lines default control points
This commit is contained in:
@@ -91,9 +91,11 @@ mindplot.ControlPoint.prototype._mouseMove = function(event, point) {
|
||||
if(point==0){
|
||||
var cords = core.Utils.calculateRelationShipPointCoordinates(this._line.getSourceTopic(),pos);
|
||||
this._line.setFrom(cords.x, cords.y);
|
||||
this._line.setSrcControlPoint(new core.Point(pos.x - cords.x,pos.y - cords.y));
|
||||
}else{
|
||||
var cords = core.Utils.calculateRelationShipPointCoordinates(this._line.getTargetTopic(),pos);
|
||||
this._line.setTo(cords.x, cords.y);
|
||||
this._line.setDestControlPoint(new core.Point(pos.x - cords.x,pos.y - cords.y));
|
||||
}
|
||||
this._controls[point].x=(pos.x - cords.x);
|
||||
this._controls[point].y=(pos.y - cords.y);
|
||||
|
@@ -644,11 +644,11 @@ mindplot.MindmapDesigner.prototype._buildRelationship = function (model) {
|
||||
var relationLine = new mindplot.RelationshipLine(fromTopic, toTopic, model.getLineType());
|
||||
if(core.Utils.isDefined(model.getSrcCtrlPoint())){
|
||||
var srcPoint = model.getSrcCtrlPoint().clone();
|
||||
relationLine.getLine().setSrcControlPoint(srcPoint);
|
||||
relationLine.setSrcControlPoint(srcPoint);
|
||||
}
|
||||
if(core.Utils.isDefined(model.getDestCtrlPoint())){
|
||||
var destPoint = model.getDestCtrlPoint().clone();
|
||||
relationLine.getLine().setDestControlPoint(destPoint);
|
||||
relationLine.setDestControlPoint(destPoint);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -61,10 +61,10 @@ mindplot.RelationshipLine.prototype.redraw = function()
|
||||
var ctrlPoints = this._line2d.getControlPoints();
|
||||
if(!core.Utils.isDefined(ctrlPoints[0].x) || !core.Utils.isDefined(ctrlPoints[1].x)){
|
||||
var defaultPoints = core.Utils.calculateDefaultControlPoints(sourcePosition, targetPosition);
|
||||
ctrlPoints[0].x=sourcePosition.x - defaultPoints[0].x;
|
||||
ctrlPoints[0].y=sourcePosition.y - defaultPoints[0].y;
|
||||
ctrlPoints[1].x=targetPosition.x - defaultPoints[1].x;
|
||||
ctrlPoints[1].y=targetPosition.y - defaultPoints[1].y;
|
||||
ctrlPoints[0].x=defaultPoints[0].x;
|
||||
ctrlPoints[0].y=defaultPoints[0].y;
|
||||
ctrlPoints[1].x=defaultPoints[1].x;
|
||||
ctrlPoints[1].y=defaultPoints[1].y;
|
||||
}
|
||||
var spoint = new core.Point();
|
||||
spoint.x=parseInt(ctrlPoints[0].x)+parseInt(sourcePosition.x);
|
||||
@@ -233,4 +233,35 @@ mindplot.RelationshipLine.prototype.setTo = function(x,y){
|
||||
this._endArrow.setFrom(x,y);
|
||||
};
|
||||
|
||||
mindplot.RelationshipLine.prototype.setSrcControlPoint = function(control){
|
||||
this._line2d.setSrcControlPoint(control);
|
||||
this._startArrow.setControlPoint(control);
|
||||
};
|
||||
|
||||
mindplot.RelationshipLine.prototype.setDestControlPoint = function(control){
|
||||
this._line2d.setDestControlPoint(control);
|
||||
this._endArrow.setControlPoint(control);
|
||||
};
|
||||
|
||||
mindplot.RelationshipLine.prototype.getControlPoints = function(){
|
||||
return this._line2d.getControlPoints();
|
||||
};
|
||||
|
||||
mindplot.RelationshipLine.prototype.isSrcControlPointCustom = function(){
|
||||
return this._line2d..isSrcControlPointCustom();
|
||||
};
|
||||
|
||||
mindplot.RelationshipLine.prototype.isDestControlPointCustom = function(){
|
||||
return this._line2d.isDestControlPointCustom();
|
||||
};
|
||||
|
||||
mindplot.RelationshipLine.prototype.setIsSrcControlPointCustom = function(isCustom){
|
||||
this._line2d.setIsSrcControlPointCustom(isCustom);
|
||||
};
|
||||
|
||||
mindplot.RelationshipLine.prototype.setIsDestControlPointCustom = function(isCustom){
|
||||
this._line2d.setIsDestControlPointCustom(isCustom);
|
||||
};
|
||||
|
||||
|
||||
mindplot.RelationshipLine.type = "RelationshipLine";
|
@@ -45,16 +45,16 @@ mindplot.commands.MoveControlPointCommand = mindplot.Command.extend(
|
||||
switch (this._point){
|
||||
case 0:
|
||||
model.setSrcCtrlPoint(this._controlPoint.clone());
|
||||
this._line.getLine().setFrom(this._endPoint.x, this._endPoint.y);
|
||||
this._line.getLine().setIsSrcControlPointCustom(true);
|
||||
this._line.getLine().setSrcControlPoint(this._controlPoint.clone());
|
||||
this._line.setFrom(this._endPoint.x, this._endPoint.y);
|
||||
this._line.setIsSrcControlPointCustom(true);
|
||||
this._line.setSrcControlPoint(this._controlPoint.clone());
|
||||
break;
|
||||
case 1:
|
||||
model.setDestCtrlPoint(this._controlPoint.clone());
|
||||
this._wasCustom = this._line.getLine().isDestControlPointCustom();
|
||||
this._line.getLine().setTo(this._endPoint.x, this._endPoint.y);
|
||||
this._line.getLine().setIsDestControlPointCustom(true);
|
||||
this._line.getLine().setDestControlPoint(this._controlPoint.clone());
|
||||
this._line.setTo(this._endPoint.x, this._endPoint.y);
|
||||
this._line.setIsDestControlPointCustom(true);
|
||||
this._line.setDestControlPoint(this._controlPoint.clone());
|
||||
break;
|
||||
}
|
||||
if(this._line.isOnFocus()){
|
||||
@@ -70,18 +70,18 @@ mindplot.commands.MoveControlPointCommand = mindplot.Command.extend(
|
||||
switch (this._point){
|
||||
case 0:
|
||||
if(core.Utils.isDefined(this._oldControlPoint)){
|
||||
line.getLine().setFrom(this._originalEndPoint.x, this._originalEndPoint.y);
|
||||
line.setFrom(this._originalEndPoint.x, this._originalEndPoint.y);
|
||||
model.setSrcCtrlPoint(this._oldControlPoint.clone());
|
||||
line.getLine().setSrcControlPoint(this._oldControlPoint.clone());
|
||||
line.getLine().setIsSrcControlPointCustom(this._wasCustom);
|
||||
line.setSrcControlPoint(this._oldControlPoint.clone());
|
||||
line.setIsSrcControlPointCustom(this._wasCustom);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(core.Utils.isDefined(this._oldControlPoint)){
|
||||
line.getLine().setTo(this._originalEndPoint.x, this._originalEndPoint.y);
|
||||
line.setTo(this._originalEndPoint.x, this._originalEndPoint.y);
|
||||
model.setDestCtrlPoint(this._oldControlPoint.clone());
|
||||
line.getLine().setDestControlPoint(this._oldControlPoint.clone());
|
||||
line.getLine().setIsDestControlPointCustom(this._wasCustom);
|
||||
line.setDestControlPoint(this._oldControlPoint.clone());
|
||||
line.setIsDestControlPointCustom(this._wasCustom);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user