diff --git a/HISTORY.md b/HISTORY.md index 6d7c8254..a52cdf92 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,6 +1,14 @@ # vis.js history http://visjs.org + +## YET TO BE RELEASED, version 4.5.1 + +### Network + +- Fixed another clustering bug, phantom edges should be gone now. +- Fixed disabling hierarchical layout. + ## 2015-07-17, version 4.5.0 ### General diff --git a/dist/vis.js b/dist/vis.js index 9c9ac8e6..f6a7a2ea 100644 --- a/dist/vis.js +++ b/dist/vis.js @@ -27428,6 +27428,8 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: 'refresh', value: function refresh() { + var clearPositions = arguments[0] === undefined ? false : arguments[0]; + var nodes = this.body.nodes; for (var nodeId in nodes) { var node = undefined; @@ -27436,7 +27438,10 @@ return /******/ (function(modules) { // webpackBootstrap } var data = this.body.data.nodes._data[nodeId]; if (node !== undefined && data !== undefined) { - node.setOptions({ fixed: false, x: null, y: null }); + if (clearPositions === true) { + node.setOptions({ x: null, y: null }); + } + node.setOptions({ fixed: false }); node.setOptions(data); } } @@ -37983,7 +37988,7 @@ return /******/ (function(modules) { // webpackBootstrap if (this.options.hierarchical.enabled === true) { if (prevHierarchicalState === true) { // refresh the overridden options for nodes and edges. - this.body.emitter.emit('refresh'); + this.body.emitter.emit('refresh', true); } // make sure the level seperation is the right way up diff --git a/lib/network/modules/LayoutEngine.js b/lib/network/modules/LayoutEngine.js index d663e1bd..9120cfaa 100644 --- a/lib/network/modules/LayoutEngine.js +++ b/lib/network/modules/LayoutEngine.js @@ -48,7 +48,7 @@ class LayoutEngine { if (this.options.hierarchical.enabled === true) { if (prevHierarchicalState === true) { // refresh the overridden options for nodes and edges. - this.body.emitter.emit('refresh'); + this.body.emitter.emit('refresh', true); } // make sure the level seperation is the right way up diff --git a/lib/network/modules/NodesHandler.js b/lib/network/modules/NodesHandler.js index ce5def8d..d8e16a67 100644 --- a/lib/network/modules/NodesHandler.js +++ b/lib/network/modules/NodesHandler.js @@ -290,7 +290,7 @@ class NodesHandler { } - refresh() { + refresh(clearPositions = false) { let nodes = this.body.nodes; for (let nodeId in nodes) { let node = undefined; @@ -299,7 +299,10 @@ class NodesHandler { } let data = this.body.data.nodes._data[nodeId]; if (node !== undefined && data !== undefined) { - node.setOptions({ fixed: false, x:null, y:null }); + if (clearPositions === true) { + node.setOptions({x:null, y:null}); + } + node.setOptions({ fixed: false }); node.setOptions(data); } } diff --git a/test/networkTest.html b/test/networkTest.html index d0fe833b..7a948c12 100644 --- a/test/networkTest.html +++ b/test/networkTest.html @@ -1,110 +1,148 @@ - Network | Clustering - - - + Network | Hierarchical layout - - - + -
- - + + + +

Hierarchical Layout - Scale-Free-Network

+ +
+ This example shows the randomly generated scale-free-network set of nodes and connected edges from example 2. + In this example, hierarchical layout has been enabled and the vertical levels are determined automatically. +
+
+ +
+ + + +
+

+ + + + + +

+ + +
+ +
+