@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/module.js CHANGED
@@ -4607,7 +4607,7 @@ class Viewer extends EventEmitter {
4607
4607
  return this._targetFrameRate;
4608
4608
  }
4609
4609
  set targetFrameRate(v) {
4610
- this._targetFrameRate = Math.max(1, v);
4610
+ this._targetFrameRate = Math.max(0.001, v);
4611
4611
  }
4612
4612
  destroy() {
4613
4613
  this._renderer.dispose();
@@ -4628,14 +4628,15 @@ class Viewer extends EventEmitter {
4628
4628
  this._time = time;
4629
4629
  if (this._targetFrameRate > -1) {
4630
4630
  const interval = 1 / this._targetFrameRate;
4631
- const delta = time - this._lastTime;
4631
+ const delta = this._time - this._lastFrameTime;
4632
4632
  if (delta >= interval) {
4633
- this.loop(delta);
4634
- this._lastTime = time - delta % interval;
4633
+ this.loop(this._time - this._lastTime);
4634
+ this._lastTime = this._time;
4635
+ this._lastFrameTime = this._time - delta % interval;
4635
4636
  }
4636
4637
  } else {
4637
- this.loop(time - this._lastTime);
4638
- this._lastTime = time;
4638
+ this.loop(this._time - this._lastTime);
4639
+ this._lastTime = this._time;
4639
4640
  }
4640
4641
  }
4641
4642
  loop(dt) {
@@ -4939,6 +4940,7 @@ class Viewer extends EventEmitter {
4939
4940
  this._rootRotated = false;
4940
4941
  this._time = 0;
4941
4942
  this._lastTime = 0;
4943
+ this._lastFrameTime = 0;
4942
4944
  this._targetFrameRate = -1;
4943
4945
  this._autoResize = true;
4944
4946
  const el = canvas || document.getElementById("canvas");