Jump to content

Babylon GUI and hardwareScalingLevel


SvenFrankson
 Share

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... ^^' )

https://www.babylonjs-playground.com/#XCPP9Y#216

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:

https://github.com/BabylonJS/Babylon.js/blob/master/src/babylon.scene.ts#L1172

To do something like what we did for the picking:

https://github.com/BabylonJS/Babylon.js/blob/master/src/babylon.scene.ts#L3553

 

Thanks for the PR, Much appreciated!

Link to comment
Share on other sites

Hi,

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

https://github.com/BabylonJS/Babylon.js/blob/d95b5a73877bdf2d89da63a9db53fe097150562a/gui/src/advancedDynamicTexture.ts#L354

(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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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