Browse Source

[Network] Fixes for loading of examples (#3332)

This PR contains two small fixes to ensure that all examples rung.
I noticed that some examples weren't working, so I tested them all.
revert-3409-performance
wimrijnders 7 years ago
committed by Yotam Berkowitz
parent
commit
a01ef86c2a
2 changed files with 8 additions and 0 deletions
  1. +3
    -0
      lib/network/Network.js
  2. +5
    -0
      lib/network/modules/PhysicsEngine.js

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

@ -273,6 +273,9 @@ Network.prototype._updateVisibleIndices = function () {
if (!this.clustering._isClusteredEdge(edgeId) if (!this.clustering._isClusteredEdge(edgeId)
&& edge.options.hidden === false && edge.options.hidden === false
// Not all nodes may be present due to interim refresh
&& nodes[edge.fromId] !== undefined
&& nodes[edge.toId ] !== undefined
// Also hidden if any of its connecting nodes are hidden // Also hidden if any of its connecting nodes are hidden
&& nodes[edge.fromId].options.hidden === false && nodes[edge.fromId].options.hidden === false
&& nodes[edge.toId ].options.hidden === false) { && nodes[edge.toId ].options.hidden === false) {

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

@ -134,6 +134,11 @@ class PhysicsEngine {
this.physicsEnabled = false; this.physicsEnabled = false;
this.stopSimulation(); this.stopSimulation();
} }
else if (options === true) {
this.options.enabled = true;
this.physicsEnabled = true;
this.startSimulation();
}
else { else {
this.physicsEnabled = true; this.physicsEnabled = true;
util.selectiveNotDeepExtend(['stabilization'], this.options, options); util.selectiveNotDeepExtend(['stabilization'], this.options, options);

Loading…
Cancel
Save