fix panning bug when scrolling up and down