mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 22:27:55 +01:00
- Fix Uncaught Cilcular connection, line:8 error
This commit is contained in:
parent
9a94326469
commit
743164ade4
@ -98,8 +98,11 @@ mindplot.RelationshipPivot = new Class({
|
|||||||
var screen = this._workspace.getScreenManager();
|
var screen = this._workspace.getScreenManager();
|
||||||
var pos = screen.getWorkspaceMousePosition(event);
|
var pos = screen.getWorkspaceMousePosition(event);
|
||||||
|
|
||||||
|
// Leave the arrow a couple of pixels away from the cursor.
|
||||||
var gapDistance = Math.sign(pos.x - this._sourceTopic.getPosition().x) * 5;
|
var gapDistance = Math.sign(pos.x - this._sourceTopic.getPosition().x) * 5;
|
||||||
|
|
||||||
this._pivot.setTo(pos.x - gapDistance, pos.y);
|
this._pivot.setTo(pos.x - gapDistance, pos.y);
|
||||||
|
|
||||||
var controlPoints = this._pivot.getControlPoints();
|
var controlPoints = this._pivot.getControlPoints();
|
||||||
this._startArrow.setFrom(pos.x - gapDistance, pos.y);
|
this._startArrow.setFrom(pos.x - gapDistance, pos.y);
|
||||||
this._startArrow.setControlPoint(controlPoints[1]);
|
this._startArrow.setControlPoint(controlPoints[1]);
|
||||||
@ -118,8 +121,12 @@ mindplot.RelationshipPivot = new Class({
|
|||||||
_connectOnFocus:function (targetTopic) {
|
_connectOnFocus:function (targetTopic) {
|
||||||
var sourceTopic = this._sourceTopic;
|
var sourceTopic = this._sourceTopic;
|
||||||
var mindmap = this._designer.getMindmap();
|
var mindmap = this._designer.getMindmap();
|
||||||
|
|
||||||
|
// Avoid circular connections ...
|
||||||
|
if (targetTopic.getId() != sourceTopic.getId()) {
|
||||||
var relModel = mindmap.createRelationship(targetTopic.getId(), sourceTopic.getId());
|
var relModel = mindmap.createRelationship(targetTopic.getId(), sourceTopic.getId());
|
||||||
this._designer._actionDispatcher.addRelationship(relModel);
|
this._designer._actionDispatcher.addRelationship(relModel);
|
||||||
|
}
|
||||||
this.dispose();
|
this.dispose();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user