mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-05 07:03:24 +01:00
- Minor improvement on relationship. Show arrow.
This commit is contained in:
parent
a86a38d157
commit
9a94326469
@ -20,7 +20,7 @@ mindplot.ConnectionLine = new Class({
|
|||||||
initialize:function (sourceNode, targetNode, lineType) {
|
initialize:function (sourceNode, targetNode, lineType) {
|
||||||
$assert(targetNode, 'parentNode node can not be null');
|
$assert(targetNode, 'parentNode node can not be null');
|
||||||
$assert(sourceNode, 'childNode node can not be null');
|
$assert(sourceNode, 'childNode node can not be null');
|
||||||
$assert(sourceNode != targetNode, 'Cilcular connection');
|
$assert(sourceNode != targetNode, 'Circular connection');
|
||||||
|
|
||||||
this._targetTopic = targetNode;
|
this._targetTopic = targetNode;
|
||||||
this._sourceTopic = sourceNode;
|
this._sourceTopic = sourceNode;
|
||||||
|
@ -39,13 +39,24 @@ mindplot.RelationshipPivot = new Class({
|
|||||||
this._workspace.enableWorkspaceEvents(false);
|
this._workspace.enableWorkspaceEvents(false);
|
||||||
|
|
||||||
var sourcePos = sourceTopic.getPosition();
|
var sourcePos = sourceTopic.getPosition();
|
||||||
|
var strokeColor = mindplot.Relationship.getStrokeColor();
|
||||||
|
|
||||||
this._pivot = new web2d.CurvedLine();
|
this._pivot = new web2d.CurvedLine();
|
||||||
this._pivot.setStyle(web2d.CurvedLine.SIMPLE_LINE);
|
this._pivot.setStyle(web2d.CurvedLine.SIMPLE_LINE);
|
||||||
this._pivot.setDashed(2, 2);
|
|
||||||
this._pivot.setFrom(sourcePos.x, sourcePos.y);
|
this._pivot.setFrom(sourcePos.x, sourcePos.y);
|
||||||
this._pivot.setTo(targetPos.x, targetPos.y);
|
|
||||||
this._workspace.appendChild(this._pivot);
|
|
||||||
|
|
||||||
|
this._pivot.setTo(targetPos.x, targetPos.y);
|
||||||
|
this._pivot.setStroke(2, 'solid', strokeColor);
|
||||||
|
this._pivot.setDashed(4, 2);
|
||||||
|
|
||||||
|
this._startArrow = new web2d.Arrow();
|
||||||
|
this._startArrow.setStrokeColor(strokeColor);
|
||||||
|
this._startArrow.setStrokeWidth(2);
|
||||||
|
this._startArrow.setFrom(sourcePos.x, sourcePos.y);
|
||||||
|
|
||||||
|
|
||||||
|
this._workspace.appendChild(this._pivot);
|
||||||
|
this._workspace.appendChild(this._startArrow);
|
||||||
|
|
||||||
this._workspace.addEvent('mousemove', this._mouseMoveEvent);
|
this._workspace.addEvent('mousemove', this._mouseMoveEvent);
|
||||||
this._workspace.addEvent('click', this._onClickEvent);
|
this._workspace.addEvent('click', this._onClickEvent);
|
||||||
@ -74,10 +85,12 @@ mindplot.RelationshipPivot = new Class({
|
|||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
workspace.removeChild(this._pivot);
|
workspace.removeChild(this._pivot);
|
||||||
|
workspace.removeChild(this._startArrow);
|
||||||
workspace.enableWorkspaceEvents(true);
|
workspace.enableWorkspaceEvents(true);
|
||||||
|
|
||||||
this._sourceTopic = null;
|
this._sourceTopic = null;
|
||||||
this._pivot = null;
|
this._pivot = null;
|
||||||
|
this._startArrow = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -85,7 +98,12 @@ mindplot.RelationshipPivot = new Class({
|
|||||||
var screen = this._workspace.getScreenManager();
|
var screen = this._workspace.getScreenManager();
|
||||||
var pos = screen.getWorkspaceMousePosition(event);
|
var pos = screen.getWorkspaceMousePosition(event);
|
||||||
|
|
||||||
this._pivot.setTo(pos.x - 1, pos.y - 1);
|
var gapDistance = Math.sign(pos.x - this._sourceTopic.getPosition().x) * 5;
|
||||||
|
this._pivot.setTo(pos.x - gapDistance, pos.y);
|
||||||
|
var controlPoints = this._pivot.getControlPoints();
|
||||||
|
this._startArrow.setFrom(pos.x - gapDistance, pos.y);
|
||||||
|
this._startArrow.setControlPoint(controlPoints[1]);
|
||||||
|
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
@ -1025,7 +1025,7 @@ mindplot.Topic = new Class({
|
|||||||
|
|
||||||
connectTo:function (targetTopic, workspace, isVisible) {
|
connectTo:function (targetTopic, workspace, isVisible) {
|
||||||
$assert(!this._outgoingLine, 'Could not connect an already connected node');
|
$assert(!this._outgoingLine, 'Could not connect an already connected node');
|
||||||
$assert(targetTopic != this, 'Cilcular connection are not allowed');
|
$assert(targetTopic != this, 'Circular connection are not allowed');
|
||||||
$assert(targetTopic, 'Parent Graph can not be null');
|
$assert(targetTopic, 'Parent Graph can not be null');
|
||||||
$assert(workspace, 'Workspace can not be null');
|
$assert(workspace, 'Workspace can not be null');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user