|
@ -45,6 +45,9 @@ function Edge (properties, network, networkConstants) { |
|
|
this.to = null; // a node
|
|
|
this.to = null; // a node
|
|
|
this.via = null; // a temp node
|
|
|
this.via = null; // a temp node
|
|
|
|
|
|
|
|
|
|
|
|
this.fromBackup = null; // used to clean up after reconnect
|
|
|
|
|
|
this.toBackup = null;; // used to clean up after reconnect
|
|
|
|
|
|
|
|
|
// we use this to be able to reconnect the edge to a cluster if its node is put into a cluster
|
|
|
// we use this to be able to reconnect the edge to a cluster if its node is put into a cluster
|
|
|
// by storing the original information we can revert to the original connection when the cluser is opened.
|
|
|
// by storing the original information we can revert to the original connection when the cluser is opened.
|
|
|
this.originalFromId = []; |
|
|
this.originalFromId = []; |
|
@ -1037,7 +1040,8 @@ Edge.prototype.positionBezierNode = function() { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* This function draws the control nodes for the manipulator. In order to enable this, only set the this.controlNodesEnabled to true. |
|
|
|
|
|
|
|
|
* This function draws the control nodes for the manipulator. |
|
|
|
|
|
* In order to enable this, only set the this.controlNodesEnabled to true. |
|
|
* @param ctx |
|
|
* @param ctx |
|
|
*/ |
|
|
*/ |
|
|
Edge.prototype._drawControlNodes = function(ctx) { |
|
|
Edge.prototype._drawControlNodes = function(ctx) { |
|
@ -1083,17 +1087,31 @@ Edge.prototype._drawControlNodes = function(ctx) { |
|
|
* @private |
|
|
* @private |
|
|
*/ |
|
|
*/ |
|
|
Edge.prototype._enableControlNodes = function() { |
|
|
Edge.prototype._enableControlNodes = function() { |
|
|
|
|
|
this.fromBackup = this.from; |
|
|
|
|
|
this.toBackup = this.to; |
|
|
this.controlNodesEnabled = true; |
|
|
this.controlNodesEnabled = true; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* disable control nodes |
|
|
|
|
|
|
|
|
* disable control nodes and remove from dynamicEdges from old node |
|
|
* @private |
|
|
* @private |
|
|
*/ |
|
|
*/ |
|
|
Edge.prototype._disableControlNodes = function() { |
|
|
Edge.prototype._disableControlNodes = function() { |
|
|
|
|
|
this.fromId = this.from.id; |
|
|
|
|
|
this.toId = this.to.id; |
|
|
|
|
|
if (this.fromId != this.fromBackup.id) { // from was changed, remove edge from old 'from' node dynamic edges
|
|
|
|
|
|
this.fromBackup.detachEdge(this); |
|
|
|
|
|
} |
|
|
|
|
|
else if (this.toId != this.toBackup.id) { // to was changed, remove edge from old 'to' node dynamic edges
|
|
|
|
|
|
this.toBackup.detachEdge(this); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.fromBackup = null; |
|
|
|
|
|
this.toBackup = null; |
|
|
this.controlNodesEnabled = false; |
|
|
this.controlNodesEnabled = false; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* This checks if one of the control nodes is selected and if so, returns the control node object. Else it returns null. |
|
|
* This checks if one of the control nodes is selected and if so, returns the control node object. Else it returns null. |
|
|
* @param x |
|
|
* @param x |
|
@ -1132,7 +1150,7 @@ Edge.prototype._restoreControlNodes = function() { |
|
|
this.connectedNode = null; |
|
|
this.connectedNode = null; |
|
|
this.controlNodes.from.unselect(); |
|
|
this.controlNodes.from.unselect(); |
|
|
} |
|
|
} |
|
|
if (this.controlNodes.to.selected == true) { |
|
|
|
|
|
|
|
|
else if (this.controlNodes.to.selected == true) { |
|
|
this.to = this.connectedNode; |
|
|
this.to = this.connectedNode; |
|
|
this.connectedNode = null; |
|
|
this.connectedNode = null; |
|
|
this.controlNodes.to.unselect(); |
|
|
this.controlNodes.to.unselect(); |
|
|