|
|
@ -12131,7 +12131,9 @@ var HierarchicalLayoutMixin = { |
|
|
|
*/ |
|
|
|
_setupHierarchicalLayout : function() { |
|
|
|
if (this.constants.hierarchicalLayout.enabled == true) { |
|
|
|
|
|
|
|
if (this.constants.hierarchicalLayout.direction == "RL" || this.constants.hierarchicalLayout.direction == "DU") { |
|
|
|
this.constants.hierarchicalLayout.levelSeparation *= -1; |
|
|
|
} |
|
|
|
// get the size of the largest hubs and check if the user has defined a level for a node.
|
|
|
|
var hubsize = 0; |
|
|
|
var node, nodeId; |
|
|
@ -12195,10 +12197,21 @@ var HierarchicalLayoutMixin = { |
|
|
|
for (nodeId in distribution[0].nodes) { |
|
|
|
if (distribution[0].nodes.hasOwnProperty(nodeId)) { |
|
|
|
node = distribution[0].nodes[nodeId]; |
|
|
|
if (node.xFixed) { |
|
|
|
node.x = distribution[0].minPos; |
|
|
|
distribution[0].minPos += distribution[0].nodeSpacing; |
|
|
|
node.xFixed = false; |
|
|
|
if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") { |
|
|
|
if (node.xFixed) { |
|
|
|
node.x = distribution[0].minPos; |
|
|
|
node.xFixed = false; |
|
|
|
|
|
|
|
distribution[0].minPos += distribution[0].nodeSpacing; |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
if (node.yFixed) { |
|
|
|
node.y = distribution[0].minPos; |
|
|
|
node.yFixed = false; |
|
|
|
|
|
|
|
distribution[0].minPos += distribution[0].nodeSpacing; |
|
|
|
} |
|
|
|
} |
|
|
|
this._placeBranchNodes(node.edges,node.id,distribution,node.level); |
|
|
|
} |
|
|
@ -12226,7 +12239,12 @@ var HierarchicalLayoutMixin = { |
|
|
|
node = this.nodes[nodeId]; |
|
|
|
node.xFixed = true; |
|
|
|
node.yFixed = true; |
|
|
|
node.y = this.constants.hierarchicalLayout.levelSeparation*node.level; |
|
|
|
if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") { |
|
|
|
node.y = this.constants.hierarchicalLayout.levelSeparation*node.level; |
|
|
|
} |
|
|
|
else { |
|
|
|
node.x = this.constants.hierarchicalLayout.levelSeparation*node.level; |
|
|
|
} |
|
|
|
if (!distribution.hasOwnProperty(node.level)) { |
|
|
|
distribution[node.level] = {amount: 0, nodes: {}, minPos:0, nodeSpacing:0}; |
|
|
|
} |
|
|
@ -12329,9 +12347,23 @@ var HierarchicalLayoutMixin = { |
|
|
|
} |
|
|
|
|
|
|
|
// if a node is conneceted to another node on the same level (or higher (means lower level))!, this is not handled here.
|
|
|
|
if (childNode.xFixed && childNode.level > parentLevel) { |
|
|
|
childNode.xFixed = false; |
|
|
|
childNode.x = distribution[childNode.level].minPos; |
|
|
|
var nodeMoved = false; |
|
|
|
if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") { |
|
|
|
if (childNode.xFixed && childNode.level > parentLevel) { |
|
|
|
childNode.xFixed = false; |
|
|
|
childNode.x = distribution[childNode.level].minPos; |
|
|
|
nodeMoved = true; |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
if (childNode.yFixed && childNode.level > parentLevel) { |
|
|
|
childNode.yFixed = false; |
|
|
|
childNode.y = distribution[childNode.level].minPos; |
|
|
|
nodeMoved = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (nodeMoved == true) { |
|
|
|
distribution[childNode.level].minPos += distribution[childNode.level].nodeSpacing; |
|
|
|
if (childNode.edges.length > 1) { |
|
|
|
this._placeBranchNodes(childNode.edges,childNode.id,distribution,childNode.level); |
|
|
@ -15606,7 +15638,8 @@ function Graph (container, data, options) { |
|
|
|
hierarchicalLayout: { |
|
|
|
enabled:false, |
|
|
|
levelSeparation: 150, |
|
|
|
nodeSpacing: 100 |
|
|
|
nodeSpacing: 100, |
|
|
|
direction: "UD" // UD, DU, LR, RL
|
|
|
|
}, |
|
|
|
smoothCurves: true, |
|
|
|
maxVelocity: 10, |
|
|
@ -15716,7 +15749,6 @@ function Graph (container, data, options) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// if clustering is disabled, the simulation will have started in the setData function
|
|
|
|
if (this.constants.clustering.enabled) { |
|
|
|
this.startWithClustering(); |
|
|
@ -16389,7 +16421,6 @@ Graph.prototype._onTap = function (event) { |
|
|
|
Graph.prototype._onDoubleTap = function (event) { |
|
|
|
var pointer = this._getPointer(event.gesture.center); |
|
|
|
this._handleDoubleTap(pointer); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -17404,12 +17435,6 @@ Graph.prototype._initializeMixinLoaders = function () { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* vis.js module exports |
|
|
|
*/ |
|
|
|