Hi im using folowing code to get spine bounds, but it does not work as expected returned rects are smaller than a spine scene.
Google leads me to a similar code.
What is wrong, help plz
Spine bounding rect is not a case for me
private static getFrameRect(spine:PIXI.spine.Spine)
{
let skeleton:PIXI.spine.core.Skeleton = spine.skeleton;
var left = 0xffff;
var top = 0xffff;
var bottom = -0xffff;
var right = -0xffff;
for (var i = 0, n = skeleton.slots.length; i < n; i++) {
let slot:PIXI.spine.core.Slot = skeleton.slots[i];
let attachment = slot.getAttachment();
if (!attachment) continue;
if (!(attachment instanceof PIXI.spine.core.RegionAttachment)) continue;
let imageRegion:PIXI.spine.core.RegionAttachment = attachment as PIXI.spine.core.RegionAttachment;
let vertices = new Array();
imageRegion.computeWorldVertices(slot.bone, vertices, 0, 2);
left = Math.min(vertices[0], left);
top = Math.min(vertices[1], top);
right = Math.max(vertices[0], right);
bottom = Math.max(vertices[1], bottom);
left = Math.min(vertices[2], left);
top = Math.min(vertices[3], top);
right = Math.max(vertices[2], right);
bottom = Math.max(vertices[3], bottom);
left = Math.min(vertices[4], left);
top = Math.min(vertices[5], top);
right = Math.max(vertices[4], right);
bottom = Math.max(vertices[5], bottom);
left = Math.min(vertices[6], left);
top = Math.min(vertices[7], top);
right = Math.max(vertices[6], right);
bottom = Math.max(vertices[7], bottom);
}
var res = {
"l":left,
"t":top,
"r":right,
"b":bottom
};
return res;
}