Browse Source

make sure an stabilized event is always fired atleast once.

flowchartTest
Alex de Mulder 9 years ago
parent
commit
f1f6989f8e
2 changed files with 2666 additions and 2662 deletions
  1. +2663
    -2661
      dist/vis.js
  2. +3
    -1
      lib/network/modules/PhysicsEngine.js

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


+ 3
- 1
lib/network/modules/PhysicsEngine.js View File

@ -21,6 +21,7 @@ class PhysicsEngine {
this.previousStates = {}; this.previousStates = {};
this.freezeCache = {}; this.freezeCache = {};
this.renderTimer = undefined; this.renderTimer = undefined;
this.initialStabilizationEmitted = false;
this.stabilized = false; this.stabilized = false;
this.startedStabilization = false; this.startedStabilization = false;
@ -237,7 +238,8 @@ class PhysicsEngine {
} }
_emitStabilized() { _emitStabilized() {
if (this.stabilizationIterations > 0) {
if (this.stabilizationIterations > 1 || this.initialStabilizationEmitted === false) {
this.initialStabilizationEmitted = true;
setTimeout(() => { setTimeout(() => {
this.body.emitter.emit('stabilized', {iterations: this.stabilizationIterations}); this.body.emitter.emit('stabilized', {iterations: this.stabilizationIterations});
this.stabilizationIterations = 0; this.stabilizationIterations = 0;

Loading…
Cancel
Save