RealyUniqueName / StablexUI

UI engine for Haxe OpenFL designed to give as much freedom as possible in customizing UI
http://ui.stablex.ru/doc
Other
337 stars 80 forks source link

Checkbox breaks layout on HTML5 target (with android4 theme) #198

Open MichaPau opened 9 years ago

MichaPau commented 9 years ago

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.

RealyUniqueName commented 9 years ago

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 commented 9 years ago

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

MichaPau commented 9 years ago

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.