Browse Source

removed random from physics. fixed setting hidden and physics dynamically, fixed manipulation system bug

flowchartTest
Alex de Mulder 9 years ago
parent
commit
50e916e3de
7 changed files with 26857 additions and 26828 deletions
  1. +26835
    -26821
      dist/vis.js
  2. +6
    -1
      examples/network/other/manipulation.html
  3. +1
    -1
      lib/network/modules/ManipulationSystem.js
  4. +1
    -2
      lib/network/modules/NodesHandler.js
  5. +4
    -0
      lib/network/modules/components/Edge.js
  6. +5
    -0
      lib/network/modules/components/Node.js
  7. +5
    -3
      lib/network/modules/components/physics/BarnesHutSolver.js

+ 26835
- 26821
dist/vis.js
File diff suppressed because it is too large
View File


+ 6
- 1
examples/network/other/manipulation.html View File

@ -98,7 +98,7 @@
document.getElementById('node-id').value = data.id;
document.getElementById('node-label').value = data.label;
document.getElementById('saveButton').onclick = saveData.bind(this, data, callback);
document.getElementById('cancelButton').onclick = clearPopUp.bind();
document.getElementById('cancelButton').onclick = cancelEdit.bind(this,callback);
document.getElementById('network-popUp').style.display = 'block';
},
addEdge: function (data, callback) {
@ -123,6 +123,11 @@
document.getElementById('network-popUp').style.display = 'none';
}
function cancelEdit(callback) {
clearPopUp();
callback(null);
}
function saveData(data,callback) {
data.id = document.getElementById('node-id').value;
data.label = document.getElementById('node-label').value;

+ 1
- 1
lib/network/modules/ManipulationSystem.js View File

@ -274,8 +274,8 @@ class ManipulationSystem {
this.options.editNode(data, (finalizedData) => {
if (finalizedData !== null && finalizedData !== undefined && this.inMode === 'editNode') { // if for whatever reason the mode has changes (due to dataset change) disregard the callback) {
this.body.data.nodes.update(finalizedData);
this.showManipulatorToolbar();
}
this.showManipulatorToolbar();
});
}
else {

+ 1
- 2
lib/network/modules/NodesHandler.js View File

@ -242,7 +242,7 @@ class NodesHandler {
let data = changedData[i];
if (node !== undefined) {
// update node
node.setOptions(data);
dataChanged = node.setOptions(data);
}
else {
dataChanged = true;
@ -411,7 +411,6 @@ class NodesHandler {
else {
console.log("NodeId provided for getConnectedEdges does not exist. Provided: ", nodeId)
}
console.log(edgeList)
return edgeList;
}

+ 4
- 0
lib/network/modules/components/Edge.js View File

@ -84,6 +84,10 @@ class Edge {
// A node is connected when it has a from and to node that both exist in the network.body.nodes.
this.connect();
if (options.hidden !== undefined || options.physics !== undefined) {
dataChanged = true;
}
return dataChanged;
}

+ 5
- 0
lib/network/modules/components/Node.js View File

@ -152,6 +152,11 @@ class Node {
// reset the size of the node, this can be changed
this._reset();
if (options.hidden !== undefined || options.physics !== undefined) {
return true;
}
return false;
}

+ 5
- 3
lib/network/modules/components/physics/BarnesHutSolver.js View File

@ -102,7 +102,7 @@ class BarnesHutSolver {
*/
_calculateForces(distance, dx, dy, node, parentBranch) {
if (distance === 0) {
distance = 0.1 * Math.random();
distance = 0.1;
dx = distance;
}
@ -282,8 +282,10 @@ class BarnesHutSolver {
// we move one node a pixel and we do not put it in the tree.
if (parentBranch.children[region].children.data.x === node.x &&
parentBranch.children[region].children.data.y === node.y) {
node.x += Math.random();
node.y += Math.random();
//node.x += Math.random();
//node.y += Math.random();
node.x += 0.1;
node.y += 0.1;
}
else {
this._splitBranch(parentBranch.children[region]);

Loading…
Cancel
Save