Browse Source

safeguard stepquality

webworkersNetwork
Alex de Mulder 9 years ago
parent
commit
f4bd6c2e6c
2 changed files with 4 additions and 2 deletions
  1. +2
    -1
      dist/vis.js
  2. +2
    -1
      lib/network/modules/PhysicsEngine.js

+ 2
- 1
dist/vis.js View File

@ -33432,6 +33432,7 @@ return /******/ (function(modules) { // webpackBootstrap
var nodeIds = Object.keys(this.previousStates); var nodeIds = Object.keys(this.previousStates);
var nodes = this.body.nodes; var nodes = this.body.nodes;
var velocities = this.physicsBody.velocities; var velocities = this.physicsBody.velocities;
this.referenceState = {};
for (var i = 0; i < nodeIds.length; i++) { for (var i = 0; i < nodeIds.length; i++) {
var nodeId = nodeIds[i]; var nodeId = nodeIds[i];
@ -33465,7 +33466,7 @@ return /******/ (function(modules) { // webpackBootstrap
var posThreshold = 0.3; var posThreshold = 0.3;
for (var nodeId in this.referenceState) { for (var nodeId in this.referenceState) {
if (this.referenceState.hasOwnProperty(nodeId)) {
if (this.referenceState.hasOwnProperty(nodeId) && nodes[nodeId] !== undefined) {
dx = nodes[nodeId].x - reference[nodeId].positions.x; dx = nodes[nodeId].x - reference[nodeId].positions.x;
dy = nodes[nodeId].y - reference[nodeId].positions.y; dy = nodes[nodeId].y - reference[nodeId].positions.y;

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

@ -417,6 +417,7 @@ class PhysicsEngine {
var nodeIds = Object.keys(this.previousStates); var nodeIds = Object.keys(this.previousStates);
var nodes = this.body.nodes; var nodes = this.body.nodes;
var velocities = this.physicsBody.velocities; var velocities = this.physicsBody.velocities;
this.referenceState = {};
for (let i = 0; i < nodeIds.length; i++) { for (let i = 0; i < nodeIds.length; i++) {
let nodeId = nodeIds[i]; let nodeId = nodeIds[i];
@ -447,7 +448,7 @@ class PhysicsEngine {
let posThreshold = 0.3; let posThreshold = 0.3;
for (let nodeId in this.referenceState) { for (let nodeId in this.referenceState) {
if (this.referenceState.hasOwnProperty(nodeId)) {
if (this.referenceState.hasOwnProperty(nodeId) && nodes[nodeId] !== undefined) {
dx = nodes[nodeId].x - reference[nodeId].positions.x; dx = nodes[nodeId].x - reference[nodeId].positions.x;
dy = nodes[nodeId].y - reference[nodeId].positions.y; dy = nodes[nodeId].y - reference[nodeId].positions.y;

Loading…
Cancel
Save