haxeui / haxeui-openfl

The OpenFL backend of the HaxeUI framework -
http://haxeui.org
MIT License
42 stars 14 forks source link

bug TextDisplay #35

Closed narenjo closed 3 years ago

narenjo commented 5 years ago

hey

I encountered a bug while using git of haxeui-openfl. on TextDisplayBase.hx:66

lib crash on var fontSizeValue = Std.int(_textStyle.fontSize); // in case of undefined textstyle.fontsize (no default value)

I have no text in my UI, I think default value must apply somewhere

image

ianharrigan commented 5 years ago

Right, looks like a bug. Just to make sure can you share a small code sample that makes it happen? Also, if you have a chance, if you switch to new-component-method branches of both haxeui-core and haxeui-openfl does the problem go away?

Thanks, Ian

narenjo commented 5 years ago

hello Ian thanks for prompt answer, I use haxe ui for my in game level editor

this is code example

`

package;

import openfl.display.Bitmap; import openfl.display.BitmapData; import openfl.display.Sprite; import openfl.Assets; import openfl.events.Event; import openfl.geom.Rectangle;

import openfl.display.Tilemap; import openfl.display.TileContainer;

import haxe.ui.Toolkit; import haxe.ui.components.Label;

import haxe.rtti.Meta;

class Main extends Sprite {

    public function new () {

super ();
    Toolkit.init();

    var myText:Label = new Label();
    myText.text = "Test Label";
    myText.color = 0x000000;
    addChild(myText);
}

} `

This code used to work for me before! To workaround I added font size to TextDisplayBase.hx

        _textStyle.fontSize = 14;
        var fontSizeValue = Std.int(_textStyle.fontSize);

I will try to switch to new-component-method branch, is that the version should I use for my in game level editor?

Thanks

ianharrigan commented 5 years ago

new-component-method will become master yes, so thats certainly a better test bed for any future UI.