|
|
@ -337,6 +337,7 @@ exports._releaseControlNode = function(pointer) { |
|
|
|
exports._handleConnect = function(pointer) { |
|
|
|
if (this._getSelectedNodeCount() == 0) { |
|
|
|
var node = this._getNodeAt(pointer); |
|
|
|
var supportNodes, targetNode, targetViaNode, connectionEdge; |
|
|
|
|
|
|
|
if (node != null) { |
|
|
|
if (node.clusterSize > 1) { |
|
|
@ -344,31 +345,35 @@ exports._handleConnect = function(pointer) { |
|
|
|
} |
|
|
|
else { |
|
|
|
this._selectObject(node,false); |
|
|
|
// create a node the temporary line can look at
|
|
|
|
this.sectors['support']['nodes']['targetNode'] = new Node({id:'targetNode'},{},{},this.constants); |
|
|
|
this.sectors['support']['nodes']['targetNode'].x = node.x; |
|
|
|
this.sectors['support']['nodes']['targetNode'].y = node.y; |
|
|
|
this.sectors['support']['nodes']['targetViaNode'] = new Node({id:'targetViaNode'},{},{},this.constants); |
|
|
|
this.sectors['support']['nodes']['targetViaNode'].x = node.x; |
|
|
|
this.sectors['support']['nodes']['targetViaNode'].y = node.y; |
|
|
|
this.sectors['support']['nodes']['targetViaNode'].parentEdgeId = "connectionEdge"; |
|
|
|
supportNodes = this.sectors['support']['nodes']; |
|
|
|
|
|
|
|
// create a node the temporary line can look at
|
|
|
|
supportNodes['targetNode'] = targetNode = new Node({id:'targetNode'},{},{},this.constants); |
|
|
|
targetNode.x = node.x; |
|
|
|
targetNode.y = node.y; |
|
|
|
|
|
|
|
supportNodes['targetViaNode'] = targetViaNode = new Node({id:'targetViaNode'},{},{},this.constants); |
|
|
|
targetViaNode.x = node.x; |
|
|
|
targetViaNode.y = node.y; |
|
|
|
targetViaNode.parentEdgeId = "connectionEdge"; |
|
|
|
|
|
|
|
// create a temporary edge
|
|
|
|
this.edges['connectionEdge'] = new Edge({id:"connectionEdge",from:node.id,to:this.sectors['support']['nodes']['targetNode'].id}, this, this.constants); |
|
|
|
this.edges['connectionEdge'].from = node; |
|
|
|
this.edges['connectionEdge'].connected = true; |
|
|
|
this.edges['connectionEdge'].smooth = true; |
|
|
|
this.edges['connectionEdge'].selected = true; |
|
|
|
this.edges['connectionEdge'].to = this.sectors['support']['nodes']['targetNode']; |
|
|
|
this.edges['connectionEdge'].via = this.sectors['support']['nodes']['targetViaNode']; |
|
|
|
this.edges['connectionEdge'] = connectionEdge = new Edge({id:"connectionEdge",from:node.id,to:targetNode.id}, this, this.constants); |
|
|
|
connectionEdge.from = node; |
|
|
|
connectionEdge.connected = true; |
|
|
|
connectionEdge.smooth = true; |
|
|
|
connectionEdge.selected = true; |
|
|
|
connectionEdge.to = targetNode; |
|
|
|
connectionEdge.via = targetViaNode; |
|
|
|
|
|
|
|
this.cachedFunctions["_handleOnDrag"] = this._handleOnDrag; |
|
|
|
this._handleOnDrag = function(event) { |
|
|
|
var pointer = this._getPointer(event.gesture.center); |
|
|
|
this.sectors['support']['nodes']['targetNode'].x = this._XconvertDOMtoCanvas(pointer.x); |
|
|
|
this.sectors['support']['nodes']['targetNode'].y = this._YconvertDOMtoCanvas(pointer.y); |
|
|
|
this.sectors['support']['nodes']['targetViaNode'].x = 0.5 * (this._XconvertDOMtoCanvas(pointer.x) + this.edges['connectionEdge'].from.x); |
|
|
|
this.sectors['support']['nodes']['targetViaNode'].y = this._YconvertDOMtoCanvas(pointer.y); |
|
|
|
var supportNodes = this.sectors['support']['nodes']; |
|
|
|
supportNodes['targetNode'].x = this._XconvertDOMtoCanvas(pointer.x); |
|
|
|
supportNodes['targetNode'].y = this._YconvertDOMtoCanvas(pointer.y); |
|
|
|
supportNodes['targetViaNode'].x = 0.5 * (this._XconvertDOMtoCanvas(pointer.x) + this.edges['connectionEdge'].from.x); |
|
|
|
supportNodes['targetViaNode'].y = this._YconvertDOMtoCanvas(pointer.y); |
|
|
|
}; |
|
|
|
|
|
|
|
this.moving = true; |
|
|
|