Fix: Do not need updateLocation when the window is invisible, otherwise will lead to the window jitter