Is it possible to freeze the cursor position in the viewport while still geting mouse delta?

I am making a blueprint that basically allows click and drag movement of a viewport displaying a 2d widget. The flow of execution goes pretty much like this:

  1. When right mouse pressed →
  2. Get mouse delta →
  3. Amplify mouse delta →
  4. New Screen Coordinates = Old Screen Coordinates + Mouse Delta →
  5. Set Position in Viewport as New Screen Coordinates

The script works fine, but the problem is that mouse still moves when holding down right click.
So my question is: Is there a function that freezes the cursor in the Viewport but still allows mouse delta capture?

Bump, if anyone knows how to do this, or if it’s even possible, I have also been struggling with this exact scenario.

There is no function for that

@dopadream - don’t place a question marked as “Answer” as it’s not an answer… This also wanted to make me skip this thread but I was curious about your “answer”

You can make your own function

Add a boolean which will check for RMB, when it’s true 1 time save coordinates then move the mouse back to this place when you’re moving the mouse - you’ll get the mouse movement still calculated and it will automatically go back to the place where you pressed the button

That’s the simplest way of doing it