mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-25 15:37:56 +01:00
Fixing minor bug with line shapes not being hidden, and changing first child line type to curved
This commit is contained in:
parent
c4858265b1
commit
0b742f2577
@ -29,8 +29,13 @@ mindplot.ConnectionLine = function(sourceNode, targetNode, lineType)
|
|||||||
var line;
|
var line;
|
||||||
if (targetNode.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
|
if (targetNode.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
|
||||||
{
|
{
|
||||||
line = this._createLine(lineType,mindplot.ConnectionLine.SIMPLE);
|
line = this._createLine(lineType,mindplot.ConnectionLine.SIMPLE_CURVED);
|
||||||
// line = new web2d.Line();
|
// line = new web2d.Line();
|
||||||
|
if(line.getType()=="CurvedLine"){
|
||||||
|
var ctrlPoints = this._getCtrlPoints(sourceNode, targetNode);
|
||||||
|
line.setSrcControlPoint(ctrlPoints[0]);
|
||||||
|
line.setDestControlPoint(ctrlPoints[1]);
|
||||||
|
}
|
||||||
line.setStroke(1, 'solid', strokeColor);
|
line.setStroke(1, 'solid', strokeColor);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
@ -42,6 +47,17 @@ mindplot.ConnectionLine = function(sourceNode, targetNode, lineType)
|
|||||||
this._line2d = line;
|
this._line2d = line;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mindplot.ConnectionLine.prototype._getCtrlPoints = function(sourceNode, targetNode){
|
||||||
|
var srcPos = sourceNode.getPosition();
|
||||||
|
var destPos = targetNode.getPosition();
|
||||||
|
var deltaX = Math.abs(Math.abs(srcPos.x) - Math.abs(destPos.x))/3;
|
||||||
|
var fix = 1;
|
||||||
|
if(mindplot.util.Shape.isAtRight(srcPos, destPos)){
|
||||||
|
fix=-1;
|
||||||
|
}
|
||||||
|
return [new core.Point(deltaX*fix, 0), new core.Point(deltaX*-fix, 0)];
|
||||||
|
};
|
||||||
|
|
||||||
mindplot.ConnectionLine.prototype._createLine = function(lineType, defaultStyle){
|
mindplot.ConnectionLine.prototype._createLine = function(lineType, defaultStyle){
|
||||||
if(!core.Utils.isDefined(lineType)){
|
if(!core.Utils.isDefined(lineType)){
|
||||||
lineType = defaultStyle;
|
lineType = defaultStyle;
|
||||||
|
@ -133,16 +133,23 @@ mindplot.MainTopic.prototype._defaultShapeType = function()
|
|||||||
mindplot.MainTopic.prototype.updateTopicShape = function(targetTopic, workspace)
|
mindplot.MainTopic.prototype.updateTopicShape = function(targetTopic, workspace)
|
||||||
{
|
{
|
||||||
// Change figure based on the connected topic ...
|
// Change figure based on the connected topic ...
|
||||||
|
var model = this.getModel();
|
||||||
|
var shapeType = model.getShapeType();
|
||||||
if (targetTopic.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
|
if (targetTopic.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
|
||||||
{
|
{
|
||||||
var model = this.getModel();
|
|
||||||
var shapeType = model.getShapeType();
|
|
||||||
if (!shapeType)
|
if (!shapeType)
|
||||||
{
|
{
|
||||||
// Get the real shape type ...
|
// Get the real shape type ...
|
||||||
shapeType = this.getShapeType();
|
shapeType = this.getShapeType();
|
||||||
this._setShapeType(mindplot.NodeModel.SHAPE_TYPE_LINE, false);
|
this._setShapeType(mindplot.NodeModel.SHAPE_TYPE_LINE, false);
|
||||||
|
}else if(shapeType==mindplot.NodeModel.SHAPE_TYPE_LINE){
|
||||||
|
var innerShape = this.getInnerShape();
|
||||||
|
innerShape.setVisibility(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
var innerShape = this.getInnerShape();
|
||||||
|
innerShape.setVisibility(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -159,6 +166,8 @@ mindplot.MainTopic.prototype.disconnect = function(workspace)
|
|||||||
shapeType = this.getShapeType();
|
shapeType = this.getShapeType();
|
||||||
this._setShapeType(mindplot.NodeModel.SHAPE_TYPE_ROUNDED_RECT, false);
|
this._setShapeType(mindplot.NodeModel.SHAPE_TYPE_ROUNDED_RECT, false);
|
||||||
}
|
}
|
||||||
|
var innerShape = this.getInnerShape();
|
||||||
|
innerShape.setVisibility(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
mindplot.MainTopic.prototype.getTopicType = function()
|
mindplot.MainTopic.prototype.getTopicType = function()
|
||||||
@ -252,6 +261,9 @@ mindplot.MainTopic.prototype.workoutOutgoingConnectionPoint = function(targetPos
|
|||||||
// In this case, connetion line is not used as shape figure.
|
// In this case, connetion line is not used as shape figure.
|
||||||
result = mindplot.util.Shape.calculateRectConnectionPoint(pos, size, isAtRight, true);
|
result = mindplot.util.Shape.calculateRectConnectionPoint(pos, size, isAtRight, true);
|
||||||
result.y = pos.y + (size.height / 2);
|
result.y = pos.y + (size.height / 2);
|
||||||
|
if(result.y>0){
|
||||||
|
result.y+=1;
|
||||||
|
}
|
||||||
|
|
||||||
// Correction factor ...
|
// Correction factor ...
|
||||||
if (!isAtRight)
|
if (!isAtRight)
|
||||||
|
Loading…
Reference in New Issue
Block a user