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