GUI Tooltip - Linked to mouse

Oh, that’s not needed for detecting the pointer over, which is handled by the pointer enter/out here:

The widthRatio and heightRatio are for placing the tooltip at under the mouse position, since the idealWidth/height “scale” the GUI to conform with the ideals, so we have to scale the pointer position by the opposite factor.

Well in this case, may be you can explain why depending on the idealSize I set and the window/canvas size/ratio my pointer is not detected when hovering a control (button) with delegate to children and detect opaque, because this is what I’m facing (and thought was related).

Just to close this topic,

Please correct if I’m wrong,

If you’re using scaling and setting a idealHeight or idealWith when creating your UI, please make sure you use something like this to get a more accurate position of a GUI element:

const guiMenu = AdvancedDynamicTexture.CreateFullscreenUI("UI");
guiMenu.idealWidth = 768;

// you can then multiply the position returned by babylon by the ratios below to get the real position,
const widthRatio = gui.idealWidth / engine.getRenderWidth();
const targetXPosition = element.x * widthRatio; // real x position;
1 Like

OK, so I asked @carolhmj about this but it seems like this would be only for placing the tooltip?!
Though I still have my problem of the pointer not correctly detecting my controls when using the image (with delegate and opaqueOnly). Depending on how I set the ideal and without using the renderWidth, my controls are not picked at a certain window scale. I will have to go back on it shortly but it is clear that changing the idealWidth and/or idealHeight affects how a control is either detected correctly or not.

I’ll take a look at your example again asap :smiley:

I tried back this morning in my scene and somehow (?!), it seems to work (now). I still have the problem in my repro in the PG (for whatever reason :dizzy_face: :thinking:. So, I’m not quite sure what it is (or was). Likely the PG might also be missing pieces.
In fine, I’ll likely check back on it later. At least, if I experience the issue in my scene again.
Meanwhile, I believe you could just leave this aside for now. Thanks and have a great day

1 Like

Thanks for checking, if you spot anything just call :saluting_face:

1 Like