|
@ -304,7 +304,6 @@ class ClusterEngine { |
|
|
* @private |
|
|
* @private |
|
|
*/ |
|
|
*/ |
|
|
_cluster(childNodesObj, childEdgesObj, options, refreshData = true) { |
|
|
_cluster(childNodesObj, childEdgesObj, options, refreshData = true) { |
|
|
console.log(childNodesObj) |
|
|
|
|
|
// kill condition: no children so cant cluster
|
|
|
// kill condition: no children so cant cluster
|
|
|
if (Object.keys(childNodesObj).length === 0) {return;} |
|
|
if (Object.keys(childNodesObj).length === 0) {return;} |
|
|
|
|
|
|
|
@ -457,8 +456,8 @@ class ClusterEngine { |
|
|
*/ |
|
|
*/ |
|
|
openCluster(clusterNodeId, options, refreshData = true) { |
|
|
openCluster(clusterNodeId, options, refreshData = true) { |
|
|
// kill conditions
|
|
|
// kill conditions
|
|
|
if (clusterNodeId === undefined) {throw new Error("No clusterNodeId supplied to openCluster.");} |
|
|
|
|
|
if (this.body.nodes[clusterNodeId] === undefined) {throw new Error("The clusterNodeId supplied to openCluster does not exist.");} |
|
|
|
|
|
|
|
|
if (clusterNodeId === undefined) {throw new Error("No clusterNodeId supplied to openCluster.");} |
|
|
|
|
|
if (this.body.nodes[clusterNodeId] === undefined) {throw new Error("The clusterNodeId supplied to openCluster does not exist.");} |
|
|
if (this.body.nodes[clusterNodeId].containedNodes === undefined) { |
|
|
if (this.body.nodes[clusterNodeId].containedNodes === undefined) { |
|
|
console.log("The node:" + clusterNodeId + " is not a cluster."); |
|
|
console.log("The node:" + clusterNodeId + " is not a cluster."); |
|
|
return |
|
|
return |
|
@ -468,7 +467,7 @@ class ClusterEngine { |
|
|
let containedEdges = clusterNode.containedEdges; |
|
|
let containedEdges = clusterNode.containedEdges; |
|
|
|
|
|
|
|
|
// allow the user to position the nodes after release.
|
|
|
// allow the user to position the nodes after release.
|
|
|
if (options.releaseFunction !== undefined) { |
|
|
|
|
|
|
|
|
if (options !== undefined && options.releaseFunction !== undefined && typeof options.releaseFunction === 'function') { |
|
|
let positions = {}; |
|
|
let positions = {}; |
|
|
let clusterPosition = {x:clusterNode.x, y:clusterNode.y}; |
|
|
let clusterPosition = {x:clusterNode.x, y:clusterNode.y}; |
|
|
for (let nodeId in containedNodes) { |
|
|
for (let nodeId in containedNodes) { |
|
|