Browse Source

bugfixes, setOptions really needs thorough testing!

flowchartTest
Alex de Mulder 9 years ago
parent
commit
9471166b2d
5 changed files with 4935 additions and 4924 deletions
  1. +4917
    -4910
      dist/vis.js
  2. +0
    -6
      lib/network/Network.js
  3. +0
    -1
      lib/network/modules/ConfigurationSystem.js
  4. +8
    -0
      lib/network/modules/NodesHandler.js
  5. +10
    -7
      lib/network/modules/components/Node.js

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


+ 0
- 6
lib/network/Network.js View File

@ -209,27 +209,21 @@ Network.prototype._updateVisibleIndices = function() {
Network.prototype.bindEventListeners = function() {
// this event will trigger a rebuilding of the cache everything. Used when nodes or edges have been added or removed.
this.body.emitter.on("_dataChanged", (params) => {
var t0 = new Date().valueOf();
// update shortcut lists
this._updateVisibleIndices();
this.physics.updatePhysicsIndices();
// call the dataUpdated event because the only difference between the two is the updating of the indices
this.body.emitter.emit("_dataUpdated");
console.log("_dataChanged took:", new Date().valueOf() - t0);
});
// this is called when options of EXISTING nodes or edges have changed.
this.body.emitter.on("_dataUpdated", () => {
var t0 = new Date().valueOf();
// update values
this._updateValueRange(this.body.nodes);
this._updateValueRange(this.body.edges);
// start simulation (can be called safely, even if already running)
this.body.emitter.emit("startSimulation");
console.log("_dataUpdated took:", new Date().valueOf() - t0);
});
}

+ 0
- 1
lib/network/modules/ConfigurationSystem.js View File

@ -653,7 +653,6 @@ class ConfigurationSystem {
pointer[path[i]] = value;
}
}
console.log('options',options)
this.network.setOptions(options);
}
}

+ 8
- 0
lib/network/modules/NodesHandler.js View File

@ -109,6 +109,14 @@ class NodesHandler {
if (parsedColor.hover.border !== undefined) {this.options.color.hover.border = parsedColor.hover.border;}
if (parsedColor.hover.background !== undefined) {this.options.color.hover.background = parsedColor.hover.background;}
}
if (options.shape !== undefined) {
for (let nodeId in this.body.nodes) {
if (this.body.nodes.hasOwnProperty(nodeId)) {
this.body.nodes[nodeId].updateShape();
}
}
}
}
}

+ 10
- 7
lib/network/modules/components/Node.js View File

@ -176,9 +176,18 @@ class Node {
}
}
this.updateShape();
this.labelModule.setOptions(this.options, options);
// reset the size of the node, this can be changed
this._reset();
}
updateShape() {
// choose draw method depending on the shape
switch (this.options.shape) {
case 'box':
this.shape = new Box(this.options, this.body, this.labelModule);
break;
@ -225,12 +234,6 @@ class Node {
this.shape = new Ellipse(this.options, this.body, this.labelModule);
break;
}
this.labelModule.setOptions(this.options, options);
// reset the size of the node, this can be changed
this._reset();
}

Loading…
Cancel
Save