implemented functionalitry for zoominfg/fitting to rectangle