Properly implement inertia for mouse movements.