ScrollViewer + StackPanel resizing

Hi !

I think I’ve found a bug in the GUI scaling when using a ScrollViewer and a Stackpanel. I’ve created a PG to test it out: https://playground.babylonjs.com/#PPANAA#4

You can resize the window to see how it changes. Even at load size (well… depending on your browser’s window size obviously) you can see how the ScrollViewer “inner-scrollable” size is taller than the vertical stackpanel and at certain aspect ratios it’s shorter, so you can’t actually see all stackpanel’s content.

Not 100% sure if this is not me missing something out as I’m pretty new to this engine. But I’ve been playing around for a while now with this.

Any help would be greatly appreciated.

Thanks.

This is a definite issue and other have brought it up recently

Issue has been raised #7337

After some testing problem seems to be the use of this._advancedTexture.idealWidth

Without this line https://playground.babylonjs.com/#PPANAA#5 the stackPanel seems to fit

Yes, I’ve seen this as well. The project is a mobile game so I do need to adaptative size in place.

I’m currently studying the ScrollViewer / ScrollViewerWindow code to see if I can get it working.

How about using relative sizes in scrollViewer https://playground.babylonjs.com/#PPANAA#6?

1 Like

I will have a look during the holidays break :slight_smile:

1 Like

The UI I’m implementing is quite a bit more complex and supporting both landscape and portrait than what’s shown on the PG. I guess I could use relative sizes on every control checking for aspect ratio to change that relative size, but I’d like to get it working by having the idealWidth if possible.

1 Like

That’d be great, thanks a lot.

I’ll keep working on other bits for now then.

1 Like

A PR is on its way to correct the bug:

2 Likes

Great news @Evgeni_Popov ! Thanks a lot .

It’s now live in the Playground.

2 Likes