|
|
@ -259,7 +259,6 @@ class ClusterEngine { |
|
|
|
_createClusterEdges (childNodesObj, childEdgesObj, clusterNodeProperties, clusterEdgeProperties) { |
|
|
|
let edge, childNodeId, childNode, toId, fromId, otherNodeId; |
|
|
|
let nodeIdField = this.body.data.nodes._fieldId; |
|
|
|
let edgeIdField = this.body.data.edges._fieldId; |
|
|
|
|
|
|
|
// loop over all child nodes and their edges to find edges going out of the cluster
|
|
|
|
// these edges will be replaced by clusterEdges.
|
|
|
@ -294,7 +293,7 @@ class ClusterEngine { |
|
|
|
|
|
|
|
// Only edges from the cluster outwards are being replaced.
|
|
|
|
if (childNodesObj[otherNodeId] === undefined) { |
|
|
|
createEdges.push({edge: edge, fromId: fromId, toId: toId}); |
|
|
|
createEdges.push({edge, fromId, toId}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -312,12 +311,12 @@ class ClusterEngine { |
|
|
|
// set up the edge
|
|
|
|
clonedOptions.from = createEdges[j].fromId; |
|
|
|
clonedOptions.to = createEdges[j].toId; |
|
|
|
clonedOptions[edgeIdField] = 'clusterEdge:' + util.randomUUID(); |
|
|
|
//clonedOptions.id = '(cf: ' + createEdges[j].fromId + " to: " + createEdges[j].toId + ")" + Math.random();
|
|
|
|
|
|
|
|
// create the edge and give a reference to the one it replaced.
|
|
|
|
let newEdge = this.body.functions.createEdge(clonedOptions); |
|
|
|
newEdge.clusteringEdgeReplacingId = edge.id; |
|
|
|
let edgeId = 'clusterEdge:' + util.randomUUID(); |
|
|
|
let newEdge = this.body.functions.createEdge(edgeId, clonedOptions); |
|
|
|
newEdge.clusteringEdgeReplacingId = edgeId; |
|
|
|
|
|
|
|
// connect the edge.
|
|
|
|
this.body.edges[newEdge.id] = newEdge; |
|
|
@ -418,11 +417,9 @@ class ClusterEngine { |
|
|
|
clusterNodeProperties.y = pos.y; |
|
|
|
} |
|
|
|
|
|
|
|
// force the ID to remain the same
|
|
|
|
clusterNodeProperties[nodeIdField] = clusterId; |
|
|
|
|
|
|
|
// create the clusterNode
|
|
|
|
let clusterNode = this.body.functions.createNode(clusterNodeProperties, Cluster); |
|
|
|
// force the ID to remain the same
|
|
|
|
let clusterNode = this.body.functions.createNode(clusterId, clusterNodeProperties, Cluster); |
|
|
|
clusterNode.isCluster = true; |
|
|
|
clusterNode.containedNodes = childNodesObj; |
|
|
|
clusterNode.containedEdges = childEdgesObj; |
|
|
@ -536,6 +533,7 @@ class ClusterEngine { |
|
|
|
return |
|
|
|
} |
|
|
|
let clusterNode = this.body.nodes[clusterNodeId]; |
|
|
|
let edgeIdField = this.body.data.edges._fieldId; |
|
|
|
let containedNodes = clusterNode.containedNodes; |
|
|
|
let containedEdges = clusterNode.containedEdges; |
|
|
|
|
|
|
@ -629,10 +627,11 @@ class ClusterEngine { |
|
|
|
|
|
|
|
// apply the edge specific options to it.
|
|
|
|
let id = 'clusterEdge:' + util.randomUUID(); |
|
|
|
util.deepExtend(clonedOptions, {from: fromId, to: toId, hidden: false, physics: true, id: id}); |
|
|
|
util.deepExtend(clonedOptions, {from: fromId, to: toId, hidden: false, physics: true}); |
|
|
|
clonedOptions[edgeIdField] = id; |
|
|
|
|
|
|
|
// create it
|
|
|
|
let newEdge = this.body.functions.createEdge(clonedOptions); |
|
|
|
let newEdge = this.body.functions.createEdge(transferEdge.id, clonedOptions); |
|
|
|
newEdge.clusteringEdgeReplacingId = transferEdge.id; |
|
|
|
this.body.edges[id] = newEdge; |
|
|
|
this.body.edges[id].connect(); |
|
|
|