Jump to content

Babylon GUI and hardwareScalingLevel


Recommended Posts

Hi everyone,

I have some issues with BABYLON.GUI on devices with more than one pixel per pixel.

(third topic this month concerning pixel ratio... ^^' )


I think the pointDown event has a value in "layout pixel", but the GUI lib uses it as "texture pixel", so it's out (if you put your cursor down right the window, you will see it fires the pointer event)

My guess :

1) Either the layout should be made in "layout pixel" : When a box is said to have a height of 100px, on a device with 0.5 ratio, it's 200px on the AdvancedRenderingTexture.

2) Either we scale the pointerInput Vector2 argument.

3) I missed an already existing option to solve this.

I'd say option 1 makes more sense, also 3 is more likely to happen :P

But it's up to you. Should I submit a PR ?

Thanks and have a nice day !

Link to comment
Share on other sites

You are completely right!

we need to update these lines:


To do something like what we did for the picking:



Thanks for the PR, Much appreciated!

Link to comment
Share on other sites


Isn't the scaling happening here for the GUI Button ? That's where I can have it working.


(I'm not yet very familiar with the pointer observable design, but I think the methods from scene.ts are not called when clicking on GUI button)

Best regards !

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...