@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.
- package/dist/Spine.d.ts +12 -3
- package/dist/Spine.js +28 -9
- package/dist/esm/spine-pixi-v8.min.mjs +3 -3
- package/dist/esm/spine-pixi-v8.mjs +27 -8
- package/dist/esm/spine-pixi-v8.mjs.map +2 -2
- package/dist/iife/spine-pixi-v8.js +27 -8
- package/dist/iife/spine-pixi-v8.js.map +2 -2
- package/dist/iife/spine-pixi-v8.min.js +3 -3
- package/package.json +2 -2
|
@@ -12883,18 +12883,33 @@ var Spine = class _Spine extends ViewContainer {
|
|
|
12883
12883
|
this._debug = value;
|
|
12884
12884
|
}
|
|
12885
12885
|
_autoUpdate = false;
|
|
12886
|
+
_ticker = Ticker.shared;
|
|
12886
12887
|
get autoUpdate() {
|
|
12887
12888
|
return this._autoUpdate;
|
|
12888
12889
|
}
|
|
12889
|
-
/** When `true`, the Spine AnimationState and the Skeleton will be automatically updated using the {@link
|
|
12890
|
+
/** When `true`, the Spine AnimationState and the Skeleton will be automatically updated using the {@link ticker}. */
|
|
12890
12891
|
set autoUpdate(value) {
|
|
12891
12892
|
if (value && !this._autoUpdate) {
|
|
12892
|
-
|
|
12893
|
+
this._ticker.add(this.internalUpdate, this);
|
|
12893
12894
|
} else if (!value && this._autoUpdate) {
|
|
12894
|
-
|
|
12895
|
+
this._ticker.remove(this.internalUpdate, this);
|
|
12895
12896
|
}
|
|
12896
12897
|
this._autoUpdate = value;
|
|
12897
12898
|
}
|
|
12899
|
+
/** The ticker to use when {@link autoUpdate} is `true`. Defaults to {@link Ticker.shared}. */
|
|
12900
|
+
get ticker() {
|
|
12901
|
+
return this._ticker;
|
|
12902
|
+
}
|
|
12903
|
+
/** 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. */
|
|
12904
|
+
set ticker(value) {
|
|
12905
|
+
value = value ?? Ticker.shared;
|
|
12906
|
+
if (this._ticker === value) return;
|
|
12907
|
+
if (this._autoUpdate) {
|
|
12908
|
+
this._ticker.remove(this.internalUpdate, this);
|
|
12909
|
+
value.add(this.internalUpdate, this);
|
|
12910
|
+
}
|
|
12911
|
+
this._ticker = value;
|
|
12912
|
+
}
|
|
12898
12913
|
_boundsProvider;
|
|
12899
12914
|
/** The bounds provider to use. If undefined the bounds will be dynamic, calculated when requested and based on the current frame. */
|
|
12900
12915
|
get boundsProvider() {
|
|
@@ -12919,6 +12934,7 @@ var Spine = class _Spine extends ViewContainer {
|
|
|
12919
12934
|
const skeletonData = options instanceof SkeletonData ? options : options.skeletonData;
|
|
12920
12935
|
this.skeleton = new Skeleton(skeletonData);
|
|
12921
12936
|
this.state = new AnimationState(new AnimationStateData(skeletonData));
|
|
12937
|
+
if (options?.ticker) this._ticker = options.ticker;
|
|
12922
12938
|
this.autoUpdate = options?.autoUpdate ?? true;
|
|
12923
12939
|
this.darkTint = options?.darkTint === void 0 ? this.skeleton.slots.some((slot) => !!slot.data.darkColor) : options?.darkTint;
|
|
12924
12940
|
const slots = this.skeleton.slots;
|
|
@@ -12932,7 +12948,7 @@ var Spine = class _Spine extends ViewContainer {
|
|
|
12932
12948
|
this.internalUpdate(0, dt);
|
|
12933
12949
|
}
|
|
12934
12950
|
internalUpdate(_deltaFrame, deltaSeconds) {
|
|
12935
|
-
this._updateAndApplyState(deltaSeconds ??
|
|
12951
|
+
this._updateAndApplyState(deltaSeconds ?? this._ticker.deltaMS / 1e3);
|
|
12936
12952
|
}
|
|
12937
12953
|
get bounds() {
|
|
12938
12954
|
if (this._boundsDirty) {
|
|
@@ -13395,7 +13411,8 @@ var Spine = class _Spine extends ViewContainer {
|
|
|
13395
13411
|
*/
|
|
13396
13412
|
destroy(options = false) {
|
|
13397
13413
|
super.destroy(options);
|
|
13398
|
-
|
|
13414
|
+
this._ticker.remove(this.internalUpdate, this);
|
|
13415
|
+
this._ticker = null;
|
|
13399
13416
|
this.state.clearListeners();
|
|
13400
13417
|
this.debug = void 0;
|
|
13401
13418
|
this.skeleton = null;
|
|
@@ -13435,14 +13452,15 @@ var Spine = class _Spine extends ViewContainer {
|
|
|
13435
13452
|
* @param options - Options to configure the Spine game object. See {@link SpineFromOptions}
|
|
13436
13453
|
* @returns {Spine} The Spine game object instantiated
|
|
13437
13454
|
*/
|
|
13438
|
-
static from({ skeleton, atlas, scale = 1, darkTint, autoUpdate = true, boundsProvider }) {
|
|
13455
|
+
static from({ skeleton, atlas, scale = 1, darkTint, autoUpdate = true, boundsProvider, ticker }) {
|
|
13439
13456
|
const cacheKey = `${skeleton}-${atlas}-${scale}`;
|
|
13440
13457
|
if (Cache.has(cacheKey)) {
|
|
13441
13458
|
return new _Spine({
|
|
13442
13459
|
skeletonData: Cache.get(cacheKey),
|
|
13443
13460
|
darkTint,
|
|
13444
13461
|
autoUpdate,
|
|
13445
|
-
boundsProvider
|
|
13462
|
+
boundsProvider,
|
|
13463
|
+
ticker
|
|
13446
13464
|
});
|
|
13447
13465
|
}
|
|
13448
13466
|
const skeletonAsset = Assets.get(skeleton);
|
|
@@ -13456,7 +13474,8 @@ var Spine = class _Spine extends ViewContainer {
|
|
|
13456
13474
|
skeletonData,
|
|
13457
13475
|
darkTint,
|
|
13458
13476
|
autoUpdate,
|
|
13459
|
-
boundsProvider
|
|
13477
|
+
boundsProvider,
|
|
13478
|
+
ticker
|
|
13460
13479
|
});
|
|
13461
13480
|
}
|
|
13462
13481
|
};
|