SvenFrankson Posted September 5, 2017 Share Posted September 5, 2017 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 But it's up to you. Should I submit a PR ? Thanks and have a nice day ! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 6, 2017 Share Posted September 6, 2017 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! Quote Link to comment Share on other sites More sharing options...
SvenFrankson Posted September 10, 2017 Author Share Posted September 10, 2017 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 ! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 11, 2017 Share Posted September 11, 2017 Your fix seems fine to me PR was merged Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.