Then when I change the rotation by 45’ the bounds are :-18.03 x 6.97
var bounds = sceneNode.globalBounds; // {x:10, y:10, width: 50, height: 100}
sceneNode.rotateAround(45, sceneNode.localCenterPoint);
// Update to original post: the next line has a typo in the size, corrected line after
// var bounds = sceneNode.globalBounds; // {x:-18.03, y:6.97, width: 50, height: 100}
var bounds = sceneNode.globalBounds; // {x:-18.03, y:6.97, width: 106.1, height: 106.1}
sceneNode.rotateAround(-sceneNode.rotation, sceneNode.localCenterPoint);
Is it possible to get the original unrotated bounds? When I manually rotate the scene node back it works but if it is outside of the edit context I get an error:
Plugin Error: Plugin abc is not permitted to make changes from the background. Return a Promise to continue execution asynchronously.
at convertPluginErrorToString (plugins/PluginErrorUtil.js:1:198)
at internalFormatPluginError (plugins/PluginErrorUtil.js:1:503)
at internalReportPluginError (plugins/PluginErrorUtil.js:1:610)
at Object.reportPluginError (plugins/PluginErrorUtil.js:1:1015)
at Object.checkAllowedToEdit (plugins/ScenegraphGuard.js:1:1097)
at Line.<anonymous> (plugins/ScenegraphWrappers.js:1:2399)
at exportLine (/Users/bob/Library/Application Support/Adobe/Adobe XD CC/develop/myplugin/main.js:100:8)
Is there a way to get the untransformed bounds:
var untransformedBounds = sceneNode.getUntransformedBounds();
@Velara There is no direct API to get the untransformed bounds at the moment. As a workaround, could you save the original bounds to a variable before transforming the objects?
Add rectangle to stage at 10x10 with dimensions of 50x100
Rotate 45
Select rectange and group
The bounds are -18.03 x 6.97 and size is 106.1 x106.1.
I know that Lines do not have a height or width sometimes as reported by sceneNode.globalBounds but they do have a height or width with sceneNode.globalDrawBounds.
If I can get the unrotated top and left values (27x30) that might solve the issues I’m running into.
PS I’ve attempted to unrotate the object to get the untransformed bounds but when I’m running my plugin process if I attempt to rotate the node back to 0 degrees I get the error mentioned above, “Plugin abc123 is not permitted to make changes from the background.”