HaxeFlixel / flixel

Free, cross-platform 2D game engine powered by Haxe and OpenFL
https://haxeflixel.com/
MIT License
1.97k stars 434 forks source link

Add `multiLine` variable to FlxText #3202

Closed Starmapo closed 2 months ago

Starmapo commented 3 months ago

This PR adds a multiLine variable to FlxText which dictates whether or not new lines are allowed in the text (if disabled, they'll just be removed from the text).

Since word wrapping will create new lines in the OpenFL text field regardless of the multiline value, I added a note about that in the documentation, but let me know if you'd prefer to just toggle off word wrapping automatically, or something else.

Geokureli commented 2 months ago

Looking into multiline more, now. it seems that I have misunderstood what multiline is used for. looks like it has no effect on textfields UNLESS they are input fields. for non-input fields, it looks like new line chars in text strings will always show up, and the field will wrap text based on the value of wordWrap.

Seems like there is no reason for there to be a multiline field in FlxText, and I was wrong for suggesting this. If there is a reason, please reopen this PR and inform me about it

Geokureli commented 2 months ago

Also, I noticed that you added multiLine with a capital "L", despite openfl having a lowercase l, since multiline is one word, if you do add a multiline property to input text or some input text handler of some kind please match this case

Starmapo commented 2 months ago

Also, I noticed that you added multiLine with a capital "L", despite openfl having a lowercase l, since multiline is one word, if you do add a multiline property to input text or some input text handler of some kind please match this case

Got it, I saw FlxBitmapText had its multiline property spelled like that so I just thought to match it to that.

Geokureli commented 2 months ago

Also, I noticed that you added multiLine with a capital "L", despite openfl having a lowercase l, since multiline is one word, if you do add a multiline property to input text or some input text handler of some kind please match this case

Got it, I saw FlxBitmapText had its multiline property spelled like that so I just thought to match it to that.

uh oh