How to center mouse cursor

The idea is to measure the axis values like this, then act on it: