# Best way to rotate a vertex selection using a Modal?

I'm trying to figure out how I should set up a modal operator that would rotate a vertex selection in Edit Mode, based on the MOUSEMOVE value, very similar to the default rotation in blender. I'd modify the script further later, to achieve some particular functionality.

The problem is, that if I enter bpy.ops.transform.rotate() or bmesh.ops.rotate() inside the def modal() function, what I get is that with every MOUSEMOVE event (every pixel that the cursor moves on screen), the rotation is triggered and thus every time the user moves the mouse by one pixel, the selection is rotated by a given value. What I'd like is that the mousemove simply update the rotation value. In other words, I'd like there to be a rotation happening that gets its value from the modal mousemove distance. What I have right now is the rotation command simply running with every mousemove and adding a certain amount of rotation to the selection. Hope that makes sense.

I've tried many things unsuccessfully, but I don't want to make this post unnecessarily long by describing all my attempts. I'd really appreciate some suggestions on the best way to achieve a Modal rotation operator pretty much exactly like the rotation works in Edit Mode...

• Related , Emulates object mode rotation using the view vector as rotation axis. .. be easy-ish to update with bmesh.ops.transfrom(...) to rotate selected verts. – batFINGER Sep 16 '18 at 15:02