function imzoomout(obj,eventdata)
%IMZOOMOUT Interactive zoom out on scrollpanel.

%   Copyright 1993-2004 The MathWorks, Inc.
%   $Revision: 1.1.8.1 $  $Date: 2004/08/10 01:50:19 $

  hIm = obj;
  hScrollpanel = getimscrollpanel(hIm,mfilename,'HIMAGE');
  apiScrollpanel = iptgetapi(hScrollpanel);

  hAx = get(obj,'parent');
  hFig = ancestor(obj, 'figure');

  pt = get(hAx,'CurrentPoint');
  x = pt(1,1);
  y = pt(1,2);

  singleClick = strcmp(get(hFig, 'SelectionType'), 'normal');
  doubleClick = strcmp(get(hFig, 'SelectionType'), 'open');  
  alt_key_pressed = strcmpi(get(hFig,'CurrentModifier'),'alt');
  
  if singleClick
    
    if alt_key_pressed
      
      new_mag = findZoomMag('in',apiScrollpanel.getMagnification());
      apiScrollpanel.setMagnificationAndCenter(new_mag,x,y) 
    else
      
      newMag = findZoomOutMagConstrained(apiScrollpanel);
      apiScrollpanel.setMagnificationAndCenter(newMag,x,y)
    end
    
  elseif doubleClick
      apiScrollpanel.setMagnification(apiScrollpanel.findFitMag())
  end
      
end
  