Image doesn't rescale to fit the new dimensions of my HolographicSlate?

,

Playground: Babylon.js Playground

Hello,

I’m working on a project where I need to display a world map inside an HolographiSlate for a XR project. However, any Control added to a slate is stretched to fit beyond the new dimensions I assigned to the slate beforehand.

It seems to me BabylonJS stores the initial rect of the slate as a square, and when the slate is resized, the rect is uniformly scaled to match whichever of its width or height is higher, meaning the underlying rect for UI elements stays a square instead of matching the new dimensions.

You can see in the playground how the image’s dimensiosn stays uniform instead of rescaling to fit the slate. Additionally, I would like to disable the scrolling feature on a slate, as I never found any documentation on this.

I’m probably doing something very wrong, but this has been bugging me for a while and I cannot find any resource on this issue. Any help would be welcome.

cc @RaananW
He’ll be back from vacation next week.

Dimensions: new BABYLON.Vector2(16, 16)

and 

h.scaling = new BABYLON.Vector3(1,.5,1)

?
1 Like

Thank you, this is what I was looking for. But isn’t there a way to rescale just the inner rect, instead of rescaling the entire slate?

1 Like

This PR will help here - [GUI] Fit texture scale to slate dimensions by RaananW · Pull Request #15502 · BabylonJS/Babylon.js (github.com)

2 Likes