Jojo
May 19, 2020, 7:56am
1
Hello everyone,
for now I have two questions about that topic:
How do I get the width and height from a group?
(group.width doesn’t work -> undefined)
(How) can I convert a pointtext into an areatext, so I can also get the width and height from it?
(not in Adobe XD itself but in Javascript)
Thanks for any help
1 Like
Hi @Jojo ,
first, regarding the second issue: textNode.areaBox
handles this: https://adobexdplatform.com/plugin-docs/reference/scenegraph.html#Text-areaBox . You should be able to just set some value for it and have some area text .
textNode.areaBox = { width: 300, height: 300 };
For groups, you can use one of the bounds
-properties (localBounds
, boundsInParent
, etc.). Usually, you’ll want to use localBounds
, which “respects” or “pre-applies” transformations of the node and node’s parents:
console.log(groupNode.localBounds.width);
console.log(groupNode.localBounds.height);
cf. https://adobexdplatform.com/plugin-docs/reference/scenegraph.html#scenenodelocalbounds--bounds
I hope this helps
1 Like