Fixed a bug when the screen is rotated