added function to update the mouse position when changing window size