fixed the error in navigating out of the window while panning