mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-21 21:57:56 +01:00
fixing arrows and curved lines default control points
This commit is contained in:
parent
82a9dc8f24
commit
314df3ca68
@ -269,5 +269,5 @@ 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(x1,y1),new core.Point(x2,y2)];
|
||||
return [new core.Point(-srcPos.x + x1,-srcPos.y + y1),new core.Point(-tarPos.x + x2,-tarPos.y + y2)];
|
||||
};
|
@ -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;
|
||||
}
|
||||
|
@ -153,49 +153,6 @@ web2d.peer.svg.CurvedLinePeer.prototype.isShowStartArrow = function(){
|
||||
web2d.peer.svg.CurvedLinePeer.prototype._updatePath = function(avoidControlPointFix)
|
||||
{
|
||||
this._calculateAutoControlPoints(avoidControlPointFix);
|
||||
var x,y, xp, yp;
|
||||
if(this._showEndArrow){
|
||||
if(this._control2.y == 0)
|
||||
this._control2.y=1;
|
||||
var y0 = this._control2.y;
|
||||
var x0 = this._control2.x;
|
||||
var x2=x0+y0;
|
||||
var y2 = y0-x0;
|
||||
var x3 = x0-y0;
|
||||
var y3 = y0+x0;
|
||||
var m = y2/x2;
|
||||
var mp = y3/x3;
|
||||
var l = 6;
|
||||
var pow = Math.pow;
|
||||
x = (x2==0?0:Math.sqrt(pow(l,2)/(1+pow(m,2))));
|
||||
x *=Math.sign(x2);
|
||||
y = (x2==0?l*Math.sign(y2):m*x);
|
||||
xp = (x3==0?0:Math.sqrt(pow(l,2)/(1+pow(mp,2))));
|
||||
xp *=Math.sign(x3);
|
||||
yp = (x3==0?l*Math.sign(y3):mp*xp);
|
||||
}
|
||||
var xs2,ys2, xp2, yp2;
|
||||
if(this._showStartArrow){
|
||||
if(this._control1.y == 0)
|
||||
this._control1.y=1;
|
||||
var y02 = this._control1.y;
|
||||
var x02 = this._control1.x;
|
||||
var x22=x02+y02;
|
||||
var y22 = y02-x02;
|
||||
var x32 = x02-y02;
|
||||
var y32 = y02+x02;
|
||||
var m2 = y22/x22;
|
||||
var mp2 = y32/x32;
|
||||
var l2 = 6;
|
||||
var pow2 = Math.pow;
|
||||
xs2 = (x22==0?0:Math.sqrt(pow2(l2,2)/(1+pow2(m2,2))));
|
||||
xs2 *=Math.sign(x22);
|
||||
ys2 = (x22==0?l2*Math.sign(y22):m2*xs2);
|
||||
xp2 = (x32==0?0:Math.sqrt(pow2(l2,2)/(1+pow2(mp2,2))));
|
||||
xp2 *=Math.sign(x32);
|
||||
yp2 = (x32==0?l2*Math.sign(y32):mp2*xp2);
|
||||
}
|
||||
|
||||
var path = "M"+this._x1+","+this._y1
|
||||
+" C"+(this._control1.x+this._x1)+","+(this._control1.y+this._y1)+" "
|
||||
+(this._control2.x+this._x2)+","+(this._control2.y+this._y2)+" "
|
||||
|
@ -645,7 +645,7 @@ ol#toc span {
|
||||
}
|
||||
|
||||
#workspaceContainer {
|
||||
/*background: url(../images/grid.gif) bottom left repeat !important;*/
|
||||
background: url(../images/grid.gif) bottom left repeat !important;
|
||||
}
|
||||
|
||||
div#mapInfo {
|
||||
@ -757,3 +757,14 @@ div#toolbar .topicRelation {
|
||||
behavior: url(../css/iepngfix.htc);
|
||||
z-index: 4;
|
||||
}
|
||||
|
||||
div#toolbar .topicRelation:hover {
|
||||
width:56px;
|
||||
background: url(../images/topic_relationship.png) no-repeat center top;
|
||||
behavior: url(../css/iepngfix.htc);
|
||||
z-index: 4;
|
||||
}
|
||||
|
||||
div#toolbar .relationshiplabel{
|
||||
width:56px;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@
|
||||
<div class="toolbarLabel"><p><spring:message code="LINK"/></p></div>
|
||||
</div>
|
||||
<div id="topicRelation" class="topicRelation button" title="<spring:message code="TOPIC_RELATIONSHIP"/>">
|
||||
<div class="toolbarLabel"><p><spring:message code="TOPIC_RELATIONSHIP"/></p></div>
|
||||
<div class="relationshiplabel toolbarLabel"><p><spring:message code="TOPIC_RELATIONSHIP"/></p></div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user