Browse Source

Merge remote-tracking branch 'origin/develop' into develop

flowchartTest
jos 9 years ago
parent
commit
7060bea565
8 changed files with 31675 additions and 31644 deletions
  1. +2
    -0
      HISTORY.md
  2. +31651
    -31637
      dist/vis.js
  3. +6
    -1
      examples/network/other/manipulation.html
  4. +1
    -1
      lib/network/modules/ManipulationSystem.js
  5. +1
    -2
      lib/network/modules/NodesHandler.js
  6. +4
    -0
      lib/network/modules/components/Edge.js
  7. +5
    -0
      lib/network/modules/components/Node.js
  8. +5
    -3
      lib/network/modules/components/physics/BarnesHutSolver.js

+ 2
- 0
HISTORY.md View File

@ -22,6 +22,8 @@ http://visjs.org
- Fixed #861, brokenImage only working for one node if nodes have the same image. - Fixed #861, brokenImage only working for one node if nodes have the same image.
- Fixed hoverNode and blurNode events and added them to the docs. - Fixed hoverNode and blurNode events and added them to the docs.
- Fixed #884, selectNode event. - Fixed #884, selectNode event.
- Fixed dynamic setting hidden and physics.
- Fixed edit node mode's fallback.
### Graph2d & Timeline ### Graph2d & Timeline

+ 31651
- 31637
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-id').value = data.id;
document.getElementById('node-label').value = data.label; document.getElementById('node-label').value = data.label;
document.getElementById('saveButton').onclick = saveData.bind(this, data, callback); 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'; document.getElementById('network-popUp').style.display = 'block';
}, },
addEdge: function (data, callback) { addEdge: function (data, callback) {
@ -123,6 +123,11 @@
document.getElementById('network-popUp').style.display = 'none'; document.getElementById('network-popUp').style.display = 'none';
} }
function cancelEdit(callback) {
clearPopUp();
callback(null);
}
function saveData(data,callback) { function saveData(data,callback) {
data.id = document.getElementById('node-id').value; data.id = document.getElementById('node-id').value;
data.label = document.getElementById('node-label').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) => { 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) { 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.body.data.nodes.update(finalizedData);
this.showManipulatorToolbar();
} }
this.showManipulatorToolbar();
}); });
} }
else { else {

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

@ -242,7 +242,7 @@ class NodesHandler {
let data = changedData[i]; let data = changedData[i];
if (node !== undefined) { if (node !== undefined) {
// update node // update node
node.setOptions(data);
dataChanged = node.setOptions(data);
} }
else { else {
dataChanged = true; dataChanged = true;
@ -411,7 +411,6 @@ class NodesHandler {
else { else {
console.log("NodeId provided for getConnectedEdges does not exist. Provided: ", nodeId) console.log("NodeId provided for getConnectedEdges does not exist. Provided: ", nodeId)
} }
console.log(edgeList)
return 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. // A node is connected when it has a from and to node that both exist in the network.body.nodes.
this.connect(); this.connect();
if (options.hidden !== undefined || options.physics !== undefined) {
dataChanged = true;
}
return dataChanged; 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 // reset the size of the node, this can be changed
this._reset(); 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) { _calculateForces(distance, dx, dy, node, parentBranch) {
if (distance === 0) { if (distance === 0) {
distance = 0.1 * Math.random();
distance = 0.1;
dx = distance; dx = distance;
} }
@ -282,8 +282,10 @@ class BarnesHutSolver {
// we move one node a pixel and we do not put it in the tree. // we move one node a pixel and we do not put it in the tree.
if (parentBranch.children[region].children.data.x === node.x && if (parentBranch.children[region].children.data.x === node.x &&
parentBranch.children[region].children.data.y === node.y) { 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 { else {
this._splitBranch(parentBranch.children[region]); this._splitBranch(parentBranch.children[region]);

Loading…
Cancel
Save