haxeui-core icon indicating copy to clipboard operation
haxeui-core copied to clipboard

`VirtualLayout` caches `itemWidth` and `itemHeight` which cause problems when `Toolkit.pixelsPerRem` value is changed

Open NipponSunrise opened this issue 1 year ago • 0 comments

VirtualLayout caches itemWidth and itemHeight which cause problems when Toolkit.pixelsPerRem value is changed. As a solution I use the following patch in ListView


class ListViewEvents extends ScrollViewEvents {
    ...
    public override function register() {
        ...
        registerEvent(UIEvent.RESIZE, onUIResize);
        ...
    }

    public override function unregister() {
        ...
        unregisterEvent(UIEvent.RESIZE, onUIResize);
        ...
    }

    private function onUIResize(e:UIEvent) {
        _listview.itemHeight = 0;
        _listview.itemWidth = 0;
    }
    ...

I'm not sure this solution follows the concepts of a framework, so it has to be re-thought. Also reworked solution should cover TableView as well.

NipponSunrise avatar Jun 15 '23 04:06 NipponSunrise