Why are you not using the gesture_detector for this code? It does the mouseTravel etc. for you.