StablexUI icon indicating copy to clipboard operation
StablexUI copied to clipboard

Checkbox breaks layout on HTML5 target (with android4 theme)

Open MichaPau opened this issue 9 years ago • 3 comments

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.

MichaPau avatar Mar 21 '15 14:03 MichaPau

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.

RealyUniqueName avatar Mar 21 '15 22:03 RealyUniqueName

I've submitted a bug report to openfl repo https://github.com/openfl/openfl/issues/546

RealyUniqueName avatar Mar 22 '15 09:03 RealyUniqueName

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.

MichaPau avatar Mar 22 '15 14:03 MichaPau