Text in coin

As a small problem, I got a solution! But why is this so?

var label = new Text(text.toString(), "20px Arial", "orange"); label.textAlign = "center"; label.x = 708; label.y = 435; label.maxWidth=40; stage.addChild(label); 

Firstly, I did not add label.maxWidth = 40. And something surprising, wriggling, it works in firefox and chrome on Ubuntu! However, he did not display anything in chrome on the windows.

Attach the maxWidth ad from the official website http://easeljs.com/docs/Text.html

maxWidth - Number The maximum width for drawing text. If the maxWidth specified (non-empty) text is compressed or compressed, to do this, insert this width.

+4
source share
1 answer

This is a bug that appeared in Chrome 17 where maxWidth is not working properly. It is fixed in version 18. Affects both the Windows and Mac versions.

+6
source

Source: https://habr.com/ru/post/1399998/


All Articles