@esotericsoftware/spine-pixi-v8 4.2.103 → 4.2.105

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,32 @@ 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
+ if (this._ticker === value) return;
13016
+ if (this._autoUpdate) {
13017
+ this._ticker.remove(this.internalUpdate, this);
13018
+ value.add(this.internalUpdate, this);
13019
+ }
13020
+ this._ticker = value;
13021
+ }
13008
13022
  _boundsProvider;
13009
13023
  /** The bounds provider to use. If undefined the bounds will be dynamic, calculated when requested and based on the current frame. */
13010
13024
  get boundsProvider() {
@@ -13029,6 +13043,7 @@ var spine = (() => {
13029
13043
  const skeletonData = options instanceof SkeletonData ? options : options.skeletonData;
13030
13044
  this.skeleton = new Skeleton(skeletonData);
13031
13045
  this.state = new AnimationState(new AnimationStateData(skeletonData));
13046
+ if (options?.ticker) this._ticker = options.ticker;
13032
13047
  this.autoUpdate = options?.autoUpdate ?? true;
13033
13048
  this.darkTint = options?.darkTint === void 0 ? this.skeleton.slots.some((slot) => !!slot.data.darkColor) : options?.darkTint;
13034
13049
  const slots = this.skeleton.slots;
@@ -13042,7 +13057,7 @@ var spine = (() => {
13042
13057
  this.internalUpdate(0, dt);
13043
13058
  }
13044
13059
  internalUpdate(_deltaFrame, deltaSeconds) {
13045
- this._updateAndApplyState(deltaSeconds ?? import_pixi8.Ticker.shared.deltaMS / 1e3);
13060
+ this._updateAndApplyState(deltaSeconds ?? this._ticker.deltaMS / 1e3);
13046
13061
  }
13047
13062
  get bounds() {
13048
13063
  if (this._boundsDirty) {
@@ -13505,7 +13520,7 @@ var spine = (() => {
13505
13520
  */
13506
13521
  destroy(options = false) {
13507
13522
  super.destroy(options);
13508
- import_pixi8.Ticker.shared.remove(this.internalUpdate, this);
13523
+ this._ticker.remove(this.internalUpdate, this);
13509
13524
  this.state.clearListeners();
13510
13525
  this.debug = void 0;
13511
13526
  this.skeleton = null;
@@ -13545,14 +13560,15 @@ var spine = (() => {
13545
13560
  * @param options - Options to configure the Spine game object. See {@link SpineFromOptions}
13546
13561
  * @returns {Spine} The Spine game object instantiated
13547
13562
  */
13548
- static from({ skeleton, atlas, scale = 1, darkTint, autoUpdate = true, boundsProvider }) {
13563
+ static from({ skeleton, atlas, scale = 1, darkTint, autoUpdate = true, boundsProvider, ticker }) {
13549
13564
  const cacheKey = `${skeleton}-${atlas}-${scale}`;
13550
13565
  if (import_pixi8.Cache.has(cacheKey)) {
13551
13566
  return new _Spine({
13552
13567
  skeletonData: import_pixi8.Cache.get(cacheKey),
13553
13568
  darkTint,
13554
13569
  autoUpdate,
13555
- boundsProvider
13570
+ boundsProvider,
13571
+ ticker
13556
13572
  });
13557
13573
  }
13558
13574
  const skeletonAsset = import_pixi8.Assets.get(skeleton);
@@ -13566,7 +13582,8 @@ var spine = (() => {
13566
13582
  skeletonData,
13567
13583
  darkTint,
13568
13584
  autoUpdate,
13569
- boundsProvider
13585
+ boundsProvider,
13586
+ ticker
13570
13587
  });
13571
13588
  }
13572
13589
  };