Skip to content

Commit

Permalink
[ts][player] Calculates animation viewport using new Skeleton.getBoun…
Browse files Browse the repository at this point in the history
…ds that considers clipping.
  • Loading branch information
davidetan committed May 3, 2024
1 parent f309722 commit 03f8f67
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion spine-ts/spine-player/src/Player.ts
Expand Up @@ -771,10 +771,11 @@ export class SpinePlayer implements Disposable {
let minX = 100000000, maxX = -100000000, minY = 100000000, maxY = -100000000;
let offset = new Vector2(), size = new Vector2();

const tempArray = new Array<number>(2);
for (let i = 0; i < steps; i++, time += stepTime) {
animation.apply(this.skeleton!, time, time, false, [], 1, MixBlend.setup, MixDirection.mixIn);
this.skeleton!.updateWorldTransform(Physics.update);
this.skeleton!.getBounds(offset, size);
this.skeleton!.getBounds(offset, size, tempArray, this.sceneRenderer!.skeletonRenderer.getSkeletonClipping());

if (!isNaN(offset.x) && !isNaN(offset.y) && !isNaN(size.x) && !isNaN(size.y)) {
minX = Math.min(offset.x, minX);
Expand Down

0 comments on commit 03f8f67

Please sign in to comment.