NativeOnMouseMove + CaptureMouse

I am attempting to create a movable widget, it seems to be working except for the movement is jittery and does not keep up with the pace of the mouse. It makes me think I am missing something on translating the absolute mouse location to local.

FReply URoMMovableWidget::NativeOnMouseMove(const FGeometry & InGeometry, const FPointerEvent & InMouseEvent)
{
	FEventReply eventReply = UWidgetBlueprintLibrary::Handled();
	if (HasMouseCapture())
	{
		eventReply = UWidgetBlueprintLibrary::CaptureMouse(eventReply, this);

		FVector2D position = USlateBlueprintLibrary::AbsoluteToLocal(InGeometry, InMouseEvent.GetScreenSpacePosition());

		UCanvasPanelSlot* movableWidgetCanvasSlot = UWidgetLayoutLibrary::SlotAsCanvasSlot(this);
		movableWidgetCanvasSlot ->SetPosition(position);
	}

	return eventReply.NativeReply;
}

any tips would be greatly appreciated

The issue was where I was calling AbsoluteToLocal from. I ended up doing this in my base Widget

void URoMMenuWidget::NativeTick(const FGeometry& MyGeometry, float InDeltaTime)
{
	CachedGeometry = MyGeometry;
}

URoMMovableWidget::NativeOnMouseMove

	FVector2D position = mainCanvas->CachedGeometry.AbsoluteToLocal(InMouseEvent.GetScreenSpacePosition());
	
	UCanvasPanelSlot* windowCanvasSlot = UWidgetLayoutLibrary::SlotAsCanvasSlot(this);
	windowCanvasSlot->SetPosition(position - offset);
1 Like