haxeui / haxeui-kha

The Kha backend of the HaxeUI framework -
http://haxeui.org
MIT License
45 stars 16 forks source link

Make top components resize with the main window #44

Closed maxfish closed 4 years ago

maxfish commented 4 years ago

This is an attempt to fix issue #41, mimicking the resizeListener from haxeui-HTML5.

It works as expected, but I'm pretty sure I don't know enough about how haxeui-kha (and haxeui in general) deals with all the different targets.

ianharrigan commented 4 years ago

I think this is fine personally, when the "screen" resizes, the top level components do. I wonder if there is a better way in kha to know when the container / canvas / window resizes though?

maxfish commented 4 years ago

I went straight with JS even if there is a function in the Window class that does exactly that: public function notifyOnResize(callback: Int->Int->Void): Void;

I just didn't know how to access the Kha window from ScreenImpl.hx 😕

ianharrigan commented 4 years ago

Yeah, the window class looks perfect - do you have any idea how you would access that in a normal, non-haxeui, application?

maxfish commented 4 years ago

I'm preparing a PR for Kha since a change is required in the library, notifyOnResize is only implemented for the Kore backend. If that goes through then we can change this repo. If not I'll probably look elsewhere for a working UI :-(

maxfish commented 4 years ago

Here is the PR https://github.com/Kode/Kha/pull/1198