refactored getMouseVelocity