It would be easier to know what’s going on with a playground reproduction, but I saw that you add the tooltipContainer in something called _playerUI, and if that’s not the top level ADT, your tooltip’s coordinates will be offset by whatever _playerUI is offset. If that’s the case, you’ll have to apply the inverse of this offset to your tooltip.
Thanks Carol, to simplify this, I’ve did a quick playground to show what I mean,
I would like the tooltip to follow my mouse as I hover over any of the black boxes, or alternatively use the gui element provided in the showTooltip function to position the tooltip to any side of that provided gui element.
I think it’s because it should read ‘adaptHeightToChild’ in case of a textBlock. It doesn’t seem to be able to recalculate from ‘stacked’ tb. Usually what I do is that either I use a grid OR if the container needs to dynamically change size (like if sometimes there is no description and it needs to adapt), I use a stackpanel with no height as the parent container. It will change height from the children containers (other stackpanels or rectangles). Then, I would constrain each textBlock I want to stack inside a container.
But then, if you have only tiltle and description, you could also just make a string, like:
var tbtext = “Item Title\n” +
If you have only one textBlock then you will not need the container to stack it.
Edit: Something like that:
Edit1: Sorry rushed it a little. I had to go for some shopping Now I’m back and quickly made a more suitable version I believe. Here it will resize no matter if there is a description or not and no matter the length of the description.
To answer original post correctly, I need a little more help,
I’ve read the docs mutliple times, and it seems to me like I need to add a multiplier or something to my tooltip position to cater for the adaptive scaling that is done automatically by babylon. (if I understand correctly, that is why everything is out of whack)
If I added a ideal width and height of 1024x768 to the PG, any idea how I would correct the position of the tooltip?
I have a question/issue similar to this. I also still do not fully understand how ideal width and height works just exactly. It seems to be desync from the resize. I’m not trying to place tooltips but I’m using ‘delegatePickingToChildren’ and ‘detectPointerOnOpaqueOnly’ which obviously calls on the image/pixels coordinates. And although visually, my image shows correctly, depending on how the canvas is scaled the pointer is detected or not. It also seems to work ‘eratically’, don’t know how to explain it. There’s something I either don’t understand or happening under the hood that might just not be always what one would expect (or as I said I don’t understand it - despite from all the hours I already spent on it an then despite from reading the docs I don’t know how many times).
Huh, sorry but that’s not what I see (SS below). But then I don’t know about @oriongu but on my side, I was pretty much willing not to bother the Team today and let you focus on the launch
My popcorn is ready and so am I
My two cents: I’m curious, because I would have expected any positions to be updated automatically when using adaptive scaling. What’s the point of having position values thats does not reflect whats on the screen? If I understand correctly, everytime I would like to find/use a position of a GUI element, I would need to apply some sort of ratio fix to get the “real” position. I’m probably missing something completely obvious, and apologize if that’s the case.
In the sake of reducing complexity on my project, I will avoid adaptive scaling for the moment.
… and focus on this very exciting new version! GO BABYLON V6! please share the popcorn @mawa
Yes, same here. I just can’t figure it.
I don’t want to ‘pollute’ your topic but I sort of feel this must be related (sry, if I’m wrong).
Here’s a link to my sketchy wheely type GUI case scenario.
Click on the top icon to the bottom right to show the wheel menu. Click on the right ‘walk’ or ‘run’ icons to expand. These all use picking from the image and detect pointer on opaque. Next, enlarge the window or click on the full-screen button (bottom right) and eventually be able or not to click on the ‘walk’ or ‘run’ expanded buttons. I tried n versions of setting or not an ideal size, coupled with scaleTo and whatever I know options do exist but no, I just can’t get this one setting that would fit all.
LOL. good question. It doesn’t capture the pointer
Basically, I’m hovering towards the center of the squares. Reason why I suggested to make the tooltip appear either on the center of the hovered square… but now that I think of it, it should may be for a start simply appear in the center of the pointer. Currently, it’s offseted from the pointer either above or below AND at various position from the pointer depending on window size/ratio.
Edit: Actually (sry again @oriongu for polluting your post), Actually… may be you could start by explaining to me (to us) why we need this in the before render function to detect whether the pointer is hovering a texture or not: