How to get some properties out of groups and text?

Hello everyone,

for now I have two questions about that topic:

  1. How do I get the width and height from a group?
    (group.width doesn’t work -> undefined)
  2. (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 :pray:

1 Like

Hi @Jojo,

first, regarding the second issue: textNode.areaBox handles this: scenegraph · Adobe XD Plugin Reference. You should be able to just set some value for it and have some area text :slightly_smiling_face:.

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. scenegraph · Adobe XD Plugin Reference

I hope this helps :slightly_smiling_face:

1 Like