Get untransformed bounds of an object

Be able to get the untransformed bounds of an element.

If an object that is sized to 100 width by 100 height is positioned at 100 x and 100 y and then the user rotates it 45° the left and top values are 79.29 x 79.29.



Is it possible to get the original untransformed bounds through an API (the original x and y)? Using the example above, if original x and y is 100 x 100 and the rotated x and y is 79.29 x 79.29 I would like to get the 100 x 100.

And if or if not, would it be possible to store the original untransformed element bounds parent right before a rotation is first applied? For example, if the original position is 100 x 100 simply store that and the parent object bounds. Maybe store the transform origin if that’s not always the center.

Use Case
A plugin author wants to export from XD to other formats and needs to know the bounds of the unrotated object.

Might have found it:

var unrotatedTransform = item.transform.rotate(-item.rotation, item.localCenterPoint.x, item.localCenterPoint.y);
var translation = unrotatedTransform.getTranslate();
console.log("unrotatedTransform.x:" + translation[0]); // 100 
console.log("unrotatedTransform.y:" + translation[1]); // 100

It looks like this will get the original width and height:

   var unrotatedBounds = unrotatedTransform.transformRect(item.localBounds);
   console.log("unrotatedBounds:", unrotatedBounds);
   unrotatedBounds: { 
    x: 100.00000877115698,
    y: 99.99999908076511,
    width: 199.99999652438217,
    height: 99.99999826219108 }

Yes this is definitely possible by applying some math. Thank you!