fix coordinate conversion bugs for mouse input