code cleanup for dragging/zooming