[BUG?] When drag and drop operation created, visual widget fly from top left to mouse pos

When drag and drop operation created, visual widget fly from top left corner of draggable widget to current mouse position instead of immediately appear at mouse position.

I think, it happened because screen position of base widget used instead of mouse position.

FReply SObjectWidget::OnDragDetected(const FGeometry& MyGeometry, const FPointerEvent& PointerEvent)
{
	if ( CanRouteEvent() )
	{
		UDragDropOperation* Operation = nullptr;
	WidgetObject->NativeOnDragDetected( MyGeometry, PointerEvent, Operation );

		if ( Operation )
		{
			FVector2D ScreenCursorPos = PointerEvent.GetScreenSpacePosition();
			FVector2D ScreenDrageePosition = MyGeometry.AbsolutePosition;  <<<< HERE

			float DPIScale = UWidgetLayoutLibrary::GetViewportScale(WidgetObject);

			TSharedRef<FUMGDragDropOp> DragDropOp = FUMGDragDropOp::New(Operation, ScreenCursorPos, ScreenDrageePosition, DPIScale, SharedThis(this));

If it not bug, why this is done in such a way?
And how i can set right position for drag widget?

Hey,Have you resolved this? I hava the same problem with you!

No, but if you find any workaround, please write it here. I will be grateful!

I ran into a similar issue, and the cause ended up being that I was creating the DragDropOperation from a parent widget that contained the thing I actually wanted to drag.

If you read through the code:

SObjectWidget::OnDragDetected

FUMGDragDropOp::New

FUMGDragDropOp::OnDragged

the assumption appears to be that the widget generating the UDragDropOperation in the OnDragDetected() handler is the thing that is going to be dragged.

In OnDragged() you can see the animation logic, and as you noticed, StartingScreenPos will be set to MyGeometry.AbsolutePosition of the SObjectWidget that created the DragDropOp in the OnDragDetected() handler.

if ( DeltaTime < AnimationTime )
		{
			float T = DeltaTime / AnimationTime;
			FVector2D LerpPosition = ( Position - StartingScreenPos ) * T;
			
			DecoratorPosition = StartingScreenPos + LerpPosition;
		}
		else
		{
			DecoratorPosition = Position;
		}

My solution was create a simple wrapper widget that connects the draggable children with the parent widget so they can share info about which sub-widget is being dragged, and to coordinate the payload passed to CreateDragDropOperation for later use in OnDrop

any progress on this one? i would like to know how to disable that animation aswell

Time and time again I’m coming back to this issue of not being able to set up StartingDrageePosition. I found a hilariously simple workaround:

Create a Dragged Visual widget and in its Construct play the following animation:

Track [[this]] object Render Opacity, start with 0 and after 0.150 seconds set Render Opacity to 1. This will hide the slide animation and widget will appear already at mouse cursor. :laughing:
Make sure your Pivot is “Center Center”.