It looks to me that the mouse position is fine, you just move the yellow ball to max screen coords, so it goes out of screen.
Just make the mousearea a ballsize smaller than the actual screen.
Just make the mousearea a ballsize smaller than the actual screen.