Is it possible to get a touch position when the button is pressed?

I have not found a single function that returns the touch position when the button is pressed. By redefining onTouchMoved, you can get coordinates if you click on widget, but onTouchEnded is often not called for the widget at all, which does not allow me to use widget instead of a button.

image

I used OnTouchStarted and it works correctly, but it does not allow you to determine when the widget will be released and onTouchEnded simply does not call if the finger goes outside the widget

Ofc:

image

If you have downstate registered, upstate is only detected when you actually release input. What’s more, for some widgets this will only trigger while we’re still hovering over.


Could you clarify the intended behaviour? Because it is not clear. You wish to hold finger down and detect sliding off the widget? Perhaps onMouseLeave would work here - never tested it with touch, though. Do tell.

I’m making a system with maps whose effects are applied to objects that the player drags them onto. Everything works correctly on the computer, but on the phone I can either get the coordinates or understand when the player released the card.

Are you dragging widgets? If so, use Drag & Drop. You then get DragEnter / Leave + everything in between, and Drop, too. And the entire Drag Operation blueprint with cancellation and all.

Alas, I don’t move the cards. To make the text easier to read, the maps are large and obscure objects when dragging. However, if I can’t find anything else, I’ll try to do it through Drag & Drop

I’m running into the same issue as well. I’m making a widget which you can slide from one end of the screen to the middle. It’s common place on phones. I need to get X, Y positions while pressing and holding. Unfortunately, On Touch Moved doesn’t give me a stream of data unless I’m moving specifically within those widget bounds.

I solved this problem through a crutch with the transfer of onTouchMoved information from the parent widget