Recreate Grab Operators in Python (Keep Cursor Stay in Editor)

I am working on an addon, and I want to do a bunch of things and having the operator to perform something similar to Grab Operator in between, I could call the Grab Operator itself, but theres so many limitation and it only works well if it is the last operation, and the grab operator Undo menu will replace my operators undo menu

and So I want to recreate the Grab Operator inside Python, the template code “” does show how to do almost most things needed, however, it couldnt loop the cursor when it move out of the editor like grab operator

I tried many different attempt to emulate this using cursor_warp and trying to get the value added so it looks like grab operator, but all my attempts are failed.

I can get the cursor to warp to keep it in the editor, however, I have couldn’t get the location value to continue adding, since it will use the cursor position.

I hope someone can help me with this :slight_smile:

Right before you warp, cache the mouse position, then after you warp add it back in.