@quake2ts/engine 0.0.780 → 0.0.781

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/esm/index.js CHANGED
@@ -15856,11 +15856,12 @@ var DemoPlaybackController = class {
15856
15856
  if (originalOnFrameUpdate) originalOnFrameUpdate(frame);
15857
15857
  if (this.currentFrameIndex >= endFrame) {
15858
15858
  this.pause();
15859
+ const completeCallback = this.callbacks?.onPlaybackComplete;
15859
15860
  if (this.callbacks === rangeCallback) {
15860
15861
  this.setCallbacks({ ...this.callbacks, onFrameUpdate: originalOnFrameUpdate });
15861
15862
  }
15862
- if (this.callbacks?.onPlaybackComplete) {
15863
- this.callbacks.onPlaybackComplete();
15863
+ if (completeCallback) {
15864
+ completeCallback();
15864
15865
  }
15865
15866
  }
15866
15867
  }
@@ -15983,8 +15984,8 @@ var DemoPlaybackController = class {
15983
15984
  return this.state;
15984
15985
  }
15985
15986
  getCurrentTime() {
15986
- if (this.currentFrameIndex < 0) return this.accumulatedTime;
15987
- return this.currentFrameIndex * this.frameDuration + this.accumulatedTime;
15987
+ if (this.currentFrameIndex < 0) return this.accumulatedTime / 1e3;
15988
+ return (this.currentFrameIndex * this.frameDuration + this.accumulatedTime) / 1e3;
15988
15989
  }
15989
15990
  getFrameCount() {
15990
15991
  return this.reader ? this.reader.getMessageCount() : 0;
@@ -16221,6 +16222,7 @@ var DemoPlaybackController = class {
16221
16222
  let count = 0;
16222
16223
  while (count < CHUNK_SIZE) {
16223
16224
  if (!this.processNextFrame()) {
16225
+ this.transitionState(0 /* Stopped */);
16224
16226
  const log = tracker.stopTracking();
16225
16227
  this.tracker = null;
16226
16228
  if (this.callbacks?.onPlaybackComplete) this.callbacks.onPlaybackComplete();
@@ -16233,6 +16235,7 @@ var DemoPlaybackController = class {
16233
16235
  };
16234
16236
  return await processChunk();
16235
16237
  } catch (e) {
16238
+ this.transitionState(0 /* Stopped */);
16236
16239
  tracker.stopTracking();
16237
16240
  this.tracker = null;
16238
16241
  throw e;
@@ -16281,6 +16284,7 @@ var DemoPlaybackController = class {
16281
16284
  let count = 0;
16282
16285
  while (count < CHUNK_SIZE) {
16283
16286
  if (this.currentFrameIndex >= endFrame || !this.processNextFrame()) {
16287
+ this.transitionState(0 /* Stopped */);
16284
16288
  const log = tracker.stopTracking();
16285
16289
  this.tracker = null;
16286
16290
  if (this.callbacks?.onPlaybackComplete) this.callbacks.onPlaybackComplete();
@@ -16293,6 +16297,7 @@ var DemoPlaybackController = class {
16293
16297
  };
16294
16298
  return await processChunk();
16295
16299
  } catch (e) {
16300
+ this.transitionState(0 /* Stopped */);
16296
16301
  tracker.stopTracking();
16297
16302
  this.tracker = null;
16298
16303
  throw e;