|
@ -22,7 +22,8 @@ function Graph (container, data, options) { |
|
|
this.renderRefreshRate = 60; // hz (fps)
|
|
|
this.renderRefreshRate = 60; // hz (fps)
|
|
|
this.renderTimestep = 1000 / this.renderRefreshRate; // ms -- saves calculation later on
|
|
|
this.renderTimestep = 1000 / this.renderRefreshRate; // ms -- saves calculation later on
|
|
|
this.renderTime = 0.5 * this.renderTimestep; // measured time it takes to render a frame
|
|
|
this.renderTime = 0.5 * this.renderTimestep; // measured time it takes to render a frame
|
|
|
this.maxRenderSteps = 3; // max amount of physics ticks per render step.
|
|
|
|
|
|
|
|
|
this.maxPhysicsTicksPerRender = 3; // max amount of physics ticks per render step.
|
|
|
|
|
|
this.physicsDiscreteStepsize = 0.65; // discrete stepsize of the simulation
|
|
|
|
|
|
|
|
|
this.stabilize = true; // stabilize before displaying the graph
|
|
|
this.stabilize = true; // stabilize before displaying the graph
|
|
|
this.selectable = true; |
|
|
this.selectable = true; |
|
@ -1756,7 +1757,7 @@ Graph.prototype._isMoving = function(vmin) { |
|
|
* @private |
|
|
* @private |
|
|
*/ |
|
|
*/ |
|
|
Graph.prototype._discreteStepNodes = function() { |
|
|
Graph.prototype._discreteStepNodes = function() { |
|
|
var interval = 0.65; |
|
|
|
|
|
|
|
|
var interval = this.physicsDiscreteStepsize; |
|
|
var nodes = this.nodes; |
|
|
var nodes = this.nodes; |
|
|
var nodeId; |
|
|
var nodeId; |
|
|
|
|
|
|
|
@ -1818,7 +1819,7 @@ Graph.prototype._animationStep = function() { |
|
|
var maxSteps = 1; |
|
|
var maxSteps = 1; |
|
|
this._physicsTick(); |
|
|
this._physicsTick(); |
|
|
var timeRequired = Date.now() - calculationTime; |
|
|
var timeRequired = Date.now() - calculationTime; |
|
|
while (timeRequired < (this.renderTimestep - this.renderTime) && maxSteps < this.maxRenderSteps) { |
|
|
|
|
|
|
|
|
while (timeRequired < (this.renderTimestep - this.renderTime) && maxSteps < this.maxPhysicsTicksPerRender) { |
|
|
this._physicsTick(); |
|
|
this._physicsTick(); |
|
|
timeRequired = Date.now() - calculationTime; |
|
|
timeRequired = Date.now() - calculationTime; |
|
|
maxSteps++; |
|
|
maxSteps++; |
|
|