how to measure text width in kineticjs?
Asked Answered
V

2

5

Is there a method or workaround to return the text width of a string in a Text Shape, in KineticJs?

I would need it to position precisely the TextShape on the canvas.

Villeneuve answered 2/10, 2012 at 18:16 Comment(0)
M
4

This might help you. It demonstrates how to get the width of some text. There is also a link to another example showing how to do this for multi-line text, here.

Martine answered 25/10, 2012 at 12:34 Comment(0)
W
9

Kinetic.Text has getTextHeight() and getTextWidht() methods to do this for you.

Wards answered 11/4, 2013 at 8:58 Comment(0)
M
4

This might help you. It demonstrates how to get the width of some text. There is also a link to another example showing how to do this for multi-line text, here.

Martine answered 25/10, 2012 at 12:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.