Handling mouse leaving the window while drawing box better.