OpenFL 9.1.0 Release

Hey everyone!

There’s a new version of OpenFL available! A huge thanks to @Dimensionscape and @MSGhero for their awesome work!

Keep building awesome everyone :sunglasses:

Changelog

  • Updated for Haxe 4.2
  • Added openfl.net.ServerSocket for TCP sockets on native platforms
  • Added openfl.net.DatagramSocket for UDP sockets on native platforms
  • Added openfl.utils.ObjectPool
  • Added shape caching to improve TextField rendering performance
  • Migrated OpenFL sources to a simpler package structure for better tooling compatibility
  • Improved Loader to prevent use of addChild/removeChild methods
  • Improved dynamic field access on openfl.utils.Object references
  • Improved handling of new lines and line breaks in TextField
  • Improved handling of layout calculations in TextField
  • Improved the rendering of selected text in TextField
  • Improved the performance when using nested TileContainer instances with Tilemap
  • Fixed an issue where graphics.lineStyle could cause an additoinal draw
  • Fixed a rounding issue that could clip graphics rendering by one pixel
  • Fixed sprite.transform.colorTransform to return a new ColorTransform object
  • Fixed issues rendering some bitmap.scrollRect objects on the HTML5 canvas renderer
  • Fixed issues rendering some gradient fills on HTML5 canvas renderer
  • Fixed an incorrect reference when dispatching some MouseEvent.ROLL_OUT events
  • Fixed renderer remaining active on Tilemap that includes no tiles
24 Likes

Very cool @singmajesty!!

And thank you @Dimensionscape and @MSGhero!

3 Likes

Wow, sounds like a time to upgrade ))

TextField.autoSize stopped working correctly on html5 after I updated the last version:

tf.defaultTextFormat = new TextFormat("Arial", 24, 0xffffff);
tf.autoSize = TextFieldAutoSize.LEFT;
tf.text = "test 1\ntest 2\ntest 3";

Only 2 lines are displayed.
To see line 3, you need to scroll the text field.
Снимок экрана 2021-07-07 в 12.32.08 Снимок экрана 2021-07-07 в 12.32.12

1 Like

It’s been my experience that you usually should set autoSize after setting the text, not before. Otherwise, there’s nothing for the text field to size itself against.

In normal behavior, this flag is set once and means that the field keeps track of changes and adjusts its size according to the content.

I temporarily solved the problem by adding an extra pixel to the height on line 741 in TextEngine

Definitely there is problem with text.autoSize in this version. I also do some workarounds…

I think that the autoSize issue with the last line being cut off is fixed on Github, so you could potentially install the latest code from there.

2 Likes

I encountered this issue today when reviewing a project from a year ago.
I removed openfl and installed the Github version using:

haxelib git openfl https://github.com/openfl/openfl.git

However, the problem persists.

After updating a text field, the following used to ensure the field was appropriately sized for the text it contained:

textField.width = textField.textWidth;
textField.height = textField.textHeight;

Currently, this causes the last line in any text field to fail to display (html5 target). For now, adding 5 extra pixels to text field height seems prevent that.

textField.height = textField.textHeight + 5;

This will make the TextField slightly too small to display its text. TextFields have an extra “gutter” that inserts about 2 pixels of empty space on all four sides of the text. Anyway, textWidth and textHeight measure the text without the gutter, so they’ll both be about 4 pixels too small when used as the width and height.

(To be clear, this is behavior that existed in Flash too, and it’s not something specific to OpenFL or the html5 target)

2 Likes

I confirm that is the normal behavior, you have to add 4 pixels height.

1 Like

Thanks @joshtynjala, I appreciate your explanation of what’s going on, and @loudo for seconding. I’ll keep it in mind when approaching text fields in future.

It is odd that it wasn’t an issue when I developed this app, this time last year. Exactly the same project files, just updated Haxe / Lime/ OpenFL, etc.