minX = Math.min(minX, vo.getRx()); minY = Math.min(minY, vo.getRy()); maxX = Math.max(maxX, vo.getRx()+vo.getRwidth()); maxY = Math.max(maxY, vo.getRy()+vo.getRheight());
if (vo instanceof Border) { Border b = (Border)vo; Enumeration e2 = b.getSubObjectsV().elements(); while (e2.hasMoreElements()) { vo = (VisibleObject)e2.nextElement(); minX = Math.min(minX, vo.getRx()); minY = Math.min(minY, vo.getRy()); maxX = Math.max(maxX, vo.getRx()+vo.getRwidth()); maxY = Math.max(maxY, vo.getRy()+vo.getRheight()); } } else { minX = Math.min(minX, vo.getRx()); minY = Math.min(minY, vo.getRy()); maxX = Math.max(maxX, vo.getRx()+vo.getRwidth()); maxY = Math.max(maxY, vo.getRy()+vo.getRheight()); }
public void smartZoom() {	ViewState view = ViewState.getInstance();	if (view.getSelectedObjects().size()==0) return;	int minX = Integer.MAX_VALUE;	int maxX = Integer.MIN_VALUE;	int minY = Integer.MAX_VALUE;	int maxY = Integer.MIN_VALUE;	VisibleObject vo;	Enumeration e = view.getSelectedObjects().elements();	while (e.hasMoreElements())	{		vo = (VisibleObject)e.nextElement();		minX = Math.min(minX, vo.getRx());		minY = Math.min(minY, vo.getRy());		maxX = Math.max(maxX, vo.getRx()+vo.getRwidth());		maxY = Math.max(maxY, vo.getRy()+vo.getRheight());	}	int space = (minX+minY+maxX+maxY)/75;	drawingSurface.zoomArea(minX-space-view.getRx(), minY-space-view.getRy(),							maxX+space-view.getRx(), maxY+space-view.getRy());}