proper panning and zooming