openfl / starling

Known as the "Cross-Platform Game Engine", Starling is a popular Stage3D framework for OpenFL and Haxe
Other
236 stars 68 forks source link

TextFieldAutoSize broken ? #64

Closed numero15 closed 6 years ago

numero15 commented 7 years ago

Hi, I got issues using TextFieldAutoSize :

jgranick commented 7 years ago

Are you using Starling 1.8 or Starling 2?

numero15 commented 7 years ago

I 'm using starling 2 (git version). It works fine with Starling 1.8.

jgranick commented 7 years ago

Thanks for reporting this issue. We'll keep working on getting Starling 2 fully operational :smile:

I believe text works in the Starling demo, but a few other features don't work yet

numero15 commented 7 years ago

Thanks for answer (and for your amazing work an openfl starling) ! I hope texts features will be operational soon.

numero15 commented 7 years ago

Hi, a little update on this issue. I retested it with the last starling version, and I managed to make it work but in a very odd way. In order to display a text with TextFieldAutoSize set to VERTICAL I had to do this : var colorTF:TextField = new TextField(150, 10, "...");
colorTF.autoSize = TextFieldAutoSize.VERTICAL; var h : Float = colorTF.height; colorTF.autoSize = TextFieldAutoSize.NONE; colorTF.height = h;

If I don't reset TextFieldAutoSize to NONE, the text doesn't show (although the box is resized).

And if I resize the window the program crashes (it seems to crash only if if I enlarge too much the window, I couldn't find the exact value). In order to prevent this I had to change the line 192 of the TextField class from if (isVerticalAutoSize) height = 100000; to if (isVerticalAutoSize) height = 10000;

I had not the single idea of what I was doing nor of why it worked. ^^

jgranick commented 6 years ago

I've confirmed that auto sizing text is working in different projects, and in the dev version of OpenFL, we've resolved the behavior for insane textField width/height values :wink:

If there is still an issue, please share some (broken) test code, thanks :smile: