implemented panning by clicking in an empty area and dragging