StablexUI
StablexUI copied to clipboard
Checkbox breaks layout on HTML5 target (with android4 theme)
Hello
A nested Checkbox is not positioned correctly when used inside a HBox. Actually all the other widgets in the HBox as well. They are all rendered at 0,0 on the top of the application window (Browser in this case).
Simple scenario (xml):
<VBox w="$Lib.current.stage.stageWidth" h="$Lib.current.stage.stageHeight"
x="0" y="0" childPadding="5"
skin:Paint-color="0x333333" skin:Paint-border="2">
<HBox>
<Text text="'some Text'"/>
<Checkbox id="'toogle_chk'" text="'Label:'"/>
</HBox>
</VBox>
and used like this in the main:
UIBuilder.setTheme('ru.stablex.ui.themes.android4');
UIBuilder.init();
var widgetRoot:Widget = UIBuilder.buildFn('assets/gui/gui.xml')();
flash.Lib.current.addChild(widgetRoot);
On neko/flash/cpp target it works as expected (text and checkbox at the center of the screen) On HTML5 target this breaks completely the "layout" when used with the android4 theme.
Looks like it's an openfl bug in embeding bitmaps via :bitmap
metadata for html5.
Themes use this way of bitmap embeding.
If i change icons in checkboxes to load bitmaps via openfl.Assets.getBitmapData()
then everything works fine.
I'll try to find a workaround.
I've submitted a bug report to openfl repo https://github.com/openfl/openfl/issues/546
thanks for the answer, as a temporary workaround I made a copy of the android4 theme and changed in defaults/Checkbox.hx the bitmap embedding for that project as you have suggested - that works.