[ts] Skeleton.getBoundsRect can now consider clipping attachments.

This commit is contained in:
Davide Tantillo 2025-01-27 15:00:43 +01:00
parent 9ca0995796
commit 3685fa7e35

View File

@ -613,10 +613,10 @@ export class Skeleton {
/** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose as `{ x: number, y: number, width: number, height: number }`. /** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose as `{ x: number, y: number, width: number, height: number }`.
* Note that this method will create temporary objects which can add to garbage collection pressure. Use `getBounds()` if garbage collection is a concern. */ * Note that this method will create temporary objects which can add to garbage collection pressure. Use `getBounds()` if garbage collection is a concern. */
getBoundsRect () { getBoundsRect (clipper?: SkeletonClipping) {
let offset = new Vector2(); let offset = new Vector2();
let size = new Vector2(); let size = new Vector2();
this.getBounds(offset, size); this.getBounds(offset, size, undefined, clipper);
return { x: offset.x, y: offset.y, width: size.x, height: size.y }; return { x: offset.x, y: offset.y, width: size.x, height: size.y };
} }