Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fairy GUI responsive in Layabox #64

Open
skymen opened this issue Nov 24, 2020 · 2 comments
Open

Fairy GUI responsive in Layabox #64

skymen opened this issue Nov 24, 2020 · 2 comments

Comments

@skymen
Copy link

skymen commented Nov 24, 2020

Hi,

I am having a few issues with layabox and fairy GUI with responsiveness.
The UI doesn't seem to scale properly when resized. The game is currently in "fixedHeight' mode, so a lot of the time, the game scales properly, but when the aspect ratio changes, the UI elements go out of the window.

Is it possible to force FairyGUI to update the height or the aspect ratio when the game rescales?
I am very limited by the fact that a lot of documentation/resources are in chinese and I sadly cannot read or understand the language so it makes it very difficult for me to know about these things if they happen to be obvious

image

@skymen
Copy link
Author

skymen commented Nov 25, 2020

Once again, I found the answer by myself by reading through the source code since it turns out that none of the api has been thoroughly documented.

You need to ask FGui to update the component manually by listening to the window resize event

window.addEventListener('resize', () => {
	if (fgui.GRoot.inst.numChildren > 0)
		fgui.GRoot.inst.getChildAt(0).makeFullScreen();
});

@xiaoguzhu
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants