Download

[UMG] Forcefully start drag & drop operation

Hello everyone.

From what I understand, the node “Create Drag & Drop Operation” only works when inside the “On Drag Detected” event override. Said event will only by fired up if the node “Detect Drag if Pressed” (or “Detect Drag”) is used and the specified key (normally a mouse button) has been pressed. Up to this moment, everything is OK.
I can start the drag & drop. Now, the intention is that if the widget is dropped over, say widget B, I want to start dragging (or rather moving) B right away.

To make things clear. The behavior I have set:
1 - click widget (an item inside of an inventory)
2 - “attach” said item to the mouse cursor (begin the drag & drop operation)
3 - click again to drop the item

I couldn’t find any way to tell UE “look, if this widget is dropped over here, don’t stop the drag & drop operation, rather update the visuals”. Is there any way to accomplish that using the internal Drag & Drop system?

After many failed attempts I did try a system where I manually handle the drag & drop.
In there, while I can start the operation by just calling a function I can’t find one way to properly get the local coordinates of the dragging within another widgets.
There is a handy event with the internal system (On Drag Over) which allows me to get the local coordinates by using “Get Screen Space Position” and “Absolute to Local” nodes.
When manually handling the dragging, all I can do to notify another widgets about the dragging is broadcast to event dispatchers.
In there, I send the mouse position retrieved by “Get Owning Player -> Get Mouse Position Scaled by DPI”.
I tried to use that coordinate with the “Absolute to Local” node but the values I got were not correct.
So, just to test, I overridden the “On Mouse Move” event and used both “Get Screen Space Position” and the “Get Mouse Position Scaled by DPI” and compared them, which gave me completely different values.
I’m sure I’m missing something here!

In short, is there a solution for any of the two approaches I have mentioned here?

Many thanks in advance!