Вопрос

var tf = new Text(letter, font, color);
var tfContainer = new Container();
tfContainer.addChild(tf);

How can I find out what are the dimensions of the 'tfContainer'?

I know I can use tf.getMeasuredWidth() and tf.getMeasuredLineHeight() but I'd rather use more general approach. Besides that doesn't return accurate measurements.

Это было полезно?

Решение

@Akonsu is correct, there is no support for width and height, largely because calculating it is very expensive, especially in vectors and groups with transformations on children. We are considering it, but there is no concrete plans for it yet.

-Lanny (gskinner.com)

Другие советы

there is no such functionality in easel.js. I read somewhere the they were planning to add it but it is not there yet as far as I know.

yes, adding width and height to the DisplayObject is a must. there could be method calculateSize(), and only when you try to get the size, to be called, if the size is invalidated and needs recalculation.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top