Shape Drawing or html export


Hello,
I want to draw the shape in the picture. But in babylonjs, I can’t put both a dynamic image area and a label inside the rectangle. What do you think is the easiest way to do this? I managed to draw this picture with html, but I could not reflect the html inside the rectangle. My goal is to make a tooltip. I request your help.

Well, there are different ways to achieve this and they all have pros and cons.
I believe first thing is you would need to choose the type of GUI you want to use

If you are looking to use the (integrated) 2D GUI of BJS, start by reading a bit about it.
You will most likely want to make an imbrication of your elements starting with a StackPanel.
Although, you could also use an ImageButton or even a Rectangle for your outter shape.
I believe the StackPanel would be the better option.
In this stackPanel, you would add a textBlock hosting your text and an Image or ImageButton for your dynamic image.

Else, the other option is to choose from any of the other UI, such as html.
It really starts by choosing one first. Next, we can eventually help you with it if needed…

2 Likes

@mawa You are amazing. Thanks for your reply and advice. I will start my work on your recommendations and get back to you.

@mawa I produced an html output as I wanted. I put this in Canvas. I only have one problem now. The HTML tooltip cannot be fixed to a mesh. For this, I thought: I think that if I can create a stackpanel and put the html output in it, all my problems can be fixed. I request your help in this matter. I can’t throw html output into stackpanel.

No, I’m afraid you can’t. These are two different GUIs and approaches. (Sadly) currently the 2D and 3D GUI do not support (any) HTML input.
I’m not sure though what you mean when you say “fixed to a mesh”? Do you mean in a 3D environment? because you can still use your mesh pick to trigger your html panel (in 2D).

Hello @farukcelim just checking in if you still have questions and if is there anything we can help with