Hi
I’ve got a widget with an image inside it. The image extends past the boundaries of the wider itself and the viewport.
I’d like to get the mouse cursor position relative to the image, is this possible?
Hi
I’ve got a widget with an image inside it. The image extends past the boundaries of the wider itself and the viewport.
I’d like to get the mouse cursor position relative to the image, is this possible?
@Arodi007 Thanks a lot, works like a charm!
You wouldn’t happen to know how to do the following:
Let’s say that I have an image in my widget anchored to the middle of the screen and the size is 1024x1024.
Now let’s say that I click a mouse button and scale the image up by 1.5. Well, the image size isn’t 1024x1024, it’s more like 1200x1200 (that’s what the mouse coordinates will be relative to it). How can I retrieve the current size of the image?
No matter what I do, it keeps returning 1024x1024 as though the image isn’t scaled up.
Thank you very much for your help, that also works and solved my problem.
One last question, if you don’t mind:
Let’s say that I’m playing in windowed mode and I’ve scaled my image up so that both sides span to the edges of the viewport, but then I change my game resolution to one that makes the viewport wider. Problem: the image scale does not automatically update and you’re left with gaps between the edges of the image and the viewport.
The image does update and automatically scales to fill the entire viewport if I click a mouse button over it even if the click has no functionality attached to it. (I guess it focuses or renders the widget again )
Anyway, is there a way to force it to re-render as though I’ve clicked a mouse button? I’d like to tie that functionality to an event called every time the resolution is changed.
You could try with Force Layout node but not sure if it will actually update the render.
And yes it pretty normal, widget are often saved as cached as optimisation and only update on request of an (event).
If you are changing the game setting resolution, the user is most likely having only the game setting menu only on his screen.
So he will eventually have to re-open the widget image (if that the case)
Unfortunately, that doesn’t work.
The settings widget can appear above the image widget so the user will be able to see the gaps or the widget being destroyed and rebuilt if I do that workaround. There must be a better way.
Can you post a video.
Try to run on NewEditorWindow as well.