@esotericsoftware/spine-pixi-v8 4.2.104 → 4.2.106

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.
@@ -12993,18 +12993,33 @@ var spine = (() => {
12993
12993
  this._debug = value;
12994
12994
  }
12995
12995
  _autoUpdate = false;
12996
+ _ticker = import_pixi8.Ticker.shared;
12996
12997
  get autoUpdate() {
12997
12998
  return this._autoUpdate;
12998
12999
  }
12999
- /** When `true`, the Spine AnimationState and the Skeleton will be automatically updated using the {@link Ticker.shared} instance. */
13000
+ /** When `true`, the Spine AnimationState and the Skeleton will be automatically updated using the {@link ticker}. */
13000
13001
  set autoUpdate(value) {
13001
13002
  if (value && !this._autoUpdate) {
13002
- import_pixi8.Ticker.shared.add(this.internalUpdate, this);
13003
+ this._ticker.add(this.internalUpdate, this);
13003
13004
  } else if (!value && this._autoUpdate) {
13004
- import_pixi8.Ticker.shared.remove(this.internalUpdate, this);
13005
+ this._ticker.remove(this.internalUpdate, this);
13005
13006
  }
13006
13007
  this._autoUpdate = value;
13007
13008
  }
13009
+ /** The ticker to use when {@link autoUpdate} is `true`. Defaults to {@link Ticker.shared}. */
13010
+ get ticker() {
13011
+ return this._ticker;
13012
+ }
13013
+ /** Sets the ticker to use when {@link autoUpdate} is `true`. If `autoUpdate` is already `true`, the update callback will be moved from the old ticker to the new one. */
13014
+ set ticker(value) {
13015
+ value = value ?? import_pixi8.Ticker.shared;
13016
+ if (this._ticker === value) return;
13017
+ if (this._autoUpdate) {
13018
+ this._ticker.remove(this.internalUpdate, this);
13019
+ value.add(this.internalUpdate, this);
13020
+ }
13021
+ this._ticker = value;
13022
+ }
13008
13023
  _boundsProvider;
13009
13024
  /** The bounds provider to use. If undefined the bounds will be dynamic, calculated when requested and based on the current frame. */
13010
13025
  get boundsProvider() {
@@ -13029,6 +13044,7 @@ var spine = (() => {
13029
13044
  const skeletonData = options instanceof SkeletonData ? options : options.skeletonData;
13030
13045
  this.skeleton = new Skeleton(skeletonData);
13031
13046
  this.state = new AnimationState(new AnimationStateData(skeletonData));
13047
+ if (options?.ticker) this._ticker = options.ticker;
13032
13048
  this.autoUpdate = options?.autoUpdate ?? true;
13033
13049
  this.darkTint = options?.darkTint === void 0 ? this.skeleton.slots.some((slot) => !!slot.data.darkColor) : options?.darkTint;
13034
13050
  const slots = this.skeleton.slots;
@@ -13042,7 +13058,7 @@ var spine = (() => {
13042
13058
  this.internalUpdate(0, dt);
13043
13059
  }
13044
13060
  internalUpdate(_deltaFrame, deltaSeconds) {
13045
- this._updateAndApplyState(deltaSeconds ?? import_pixi8.Ticker.shared.deltaMS / 1e3);
13061
+ this._updateAndApplyState(deltaSeconds ?? this._ticker.deltaMS / 1e3);
13046
13062
  }
13047
13063
  get bounds() {
13048
13064
  if (this._boundsDirty) {
@@ -13505,7 +13521,8 @@ var spine = (() => {
13505
13521
  */
13506
13522
  destroy(options = false) {
13507
13523
  super.destroy(options);
13508
- import_pixi8.Ticker.shared.remove(this.internalUpdate, this);
13524
+ this._ticker.remove(this.internalUpdate, this);
13525
+ this._ticker = null;
13509
13526
  this.state.clearListeners();
13510
13527
  this.debug = void 0;
13511
13528
  this.skeleton = null;
@@ -13545,14 +13562,15 @@ var spine = (() => {
13545
13562
  * @param options - Options to configure the Spine game object. See {@link SpineFromOptions}
13546
13563
  * @returns {Spine} The Spine game object instantiated
13547
13564
  */
13548
- static from({ skeleton, atlas, scale = 1, darkTint, autoUpdate = true, boundsProvider }) {
13565
+ static from({ skeleton, atlas, scale = 1, darkTint, autoUpdate = true, boundsProvider, ticker }) {
13549
13566
  const cacheKey = `${skeleton}-${atlas}-${scale}`;
13550
13567
  if (import_pixi8.Cache.has(cacheKey)) {
13551
13568
  return new _Spine({
13552
13569
  skeletonData: import_pixi8.Cache.get(cacheKey),
13553
13570
  darkTint,
13554
13571
  autoUpdate,
13555
- boundsProvider
13572
+ boundsProvider,
13573
+ ticker
13556
13574
  });
13557
13575
  }
13558
13576
  const skeletonAsset = import_pixi8.Assets.get(skeleton);
@@ -13566,7 +13584,8 @@ var spine = (() => {
13566
13584
  skeletonData,
13567
13585
  darkTint,
13568
13586
  autoUpdate,
13569
- boundsProvider
13587
+ boundsProvider,
13588
+ ticker
13570
13589
  });
13571
13590
  }
13572
13591
  };