Skip to main content
Avana_Vana
New Participant
May 29, 2024
Solved

Methods and/or Properties for Getting Dimensions of Lines of Text within Text Node?

  • May 29, 2024
  • 11 replies
  • 877 views

Hi,

I’m trying to figure out a way to use the Plugin API to get various internal dimensions of a text node—specifically, the width of each line of text, and the (x, y) position of each line of text, or even better yet, the (x, y) position of any arbitrary character within a text node.

Is this possible?

See the attached image for clarification as to what I am trying to determine programatically.

This topic has been closed for replies.
Best answer by tank666

Use an event listener instead of a delay function:

The event will fire when the node properties change.

11 replies

Avana_Vana
New Participant
June 9, 2024

@tank666 I should have listened to you earlier. on('nodechange', callback) was indeed the answer I needed, not so much from a debugging perspective, but as you correctly point out in your latest message, as a trigger for the rest of the action.

Works great!

Only problem is that I now have to clean up the event listener with off(), but you have to pass an exact reference to the callback function to off(), and the way my code is written, this will be complicated to achieve. Oh well, I will figure it out.

Thanks again.