Fixed the viewer issues when panning the image on the edges of the viewport