From a01ef86c2a64255cf55dcb75eaecfe9e7b58e51c Mon Sep 17 00:00:00 2001 From: wimrijnders Date: Wed, 2 Aug 2017 22:22:28 +0200 Subject: [PATCH] [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. --- lib/network/Network.js | 3 +++ lib/network/modules/PhysicsEngine.js | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/lib/network/Network.js b/lib/network/Network.js index d43f60e4..54a0242c 100644 --- a/lib/network/Network.js +++ b/lib/network/Network.js @@ -273,6 +273,9 @@ Network.prototype._updateVisibleIndices = function () { if (!this.clustering._isClusteredEdge(edgeId) && 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 && nodes[edge.fromId].options.hidden === false && nodes[edge.toId ].options.hidden === false) { diff --git a/lib/network/modules/PhysicsEngine.js b/lib/network/modules/PhysicsEngine.js index 5f176a9d..2fe9b52e 100644 --- a/lib/network/modules/PhysicsEngine.js +++ b/lib/network/modules/PhysicsEngine.js @@ -134,6 +134,11 @@ class PhysicsEngine { this.physicsEnabled = false; this.stopSimulation(); } + else if (options === true) { + this.options.enabled = true; + this.physicsEnabled = true; + this.startSimulation(); + } else { this.physicsEnabled = true; util.selectiveNotDeepExtend(['stabilization'], this.options, options);