@xviewer.js/core 1.0.0-alpha.48 → 1.0.0-alpha.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -4609,7 +4609,7 @@ class Viewer extends EventEmitter {
4609
4609
  return this._targetFrameRate;
4610
4610
  }
4611
4611
  set targetFrameRate(v) {
4612
- this._targetFrameRate = Math.max(1, v);
4612
+ this._targetFrameRate = Math.max(0.001, v);
4613
4613
  }
4614
4614
  destroy() {
4615
4615
  this._renderer.dispose();
@@ -4630,14 +4630,15 @@ class Viewer extends EventEmitter {
4630
4630
  this._time = time;
4631
4631
  if (this._targetFrameRate > -1) {
4632
4632
  const interval = 1 / this._targetFrameRate;
4633
- const delta = time - this._lastTime;
4633
+ const delta = this._time - this._lastFrameTime;
4634
4634
  if (delta >= interval) {
4635
- this.loop(delta);
4636
- this._lastTime = time - delta % interval;
4635
+ this.loop(this._time - this._lastTime);
4636
+ this._lastTime = this._time;
4637
+ this._lastFrameTime = this._time - delta % interval;
4637
4638
  }
4638
4639
  } else {
4639
- this.loop(time - this._lastTime);
4640
- this._lastTime = time;
4640
+ this.loop(this._time - this._lastTime);
4641
+ this._lastTime = this._time;
4641
4642
  }
4642
4643
  }
4643
4644
  loop(dt) {
@@ -4941,6 +4942,7 @@ class Viewer extends EventEmitter {
4941
4942
  this._rootRotated = false;
4942
4943
  this._time = 0;
4943
4944
  this._lastTime = 0;
4945
+ this._lastFrameTime = 0;
4944
4946
  this._targetFrameRate = -1;
4945
4947
  this._autoResize = true;
4946
4948
  const el = canvas || document.getElementById("canvas");