- Fix Uncaught Cilcular connection, line:8 error

This commit is contained in:
Paulo Gustavo Veiga 2012-09-04 23:41:34 -03:00
parent 9a94326469
commit 743164ade4

View File

@ -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();
var relModel = mindmap.createRelationship(targetTopic.getId(), sourceTopic.getId());
this._designer._actionDispatcher.addRelationship(relModel); // Avoid circular connections ...
if (targetTopic.getId() != sourceTopic.getId()) {
var relModel = mindmap.createRelationship(targetTopic.getId(), sourceTopic.getId());
this._designer._actionDispatcher.addRelationship(relModel);
}
this.dispose(); this.dispose();
}, },