@Override // from interface IRectangle public Rectangle union (IRectangle r) { Rectangle rect = new Rectangle(this); rect.add(r); return rect; }
@Override // from interface IRectangle public Rectangle union (IRectangle r) { Rectangle rect = new Rectangle(this); rect.add(r); return rect; }
/** * Expands the bounds of this rectangle to contain the supplied point. */ public void add (XY p) { add(p.x(), p.y()); }
/** * Expands the bounds of this rectangle to contain the supplied point. */ public void add (XY p) { add(p.x(), p.y()); }
/** Helper function for {@link #totalBounds}. */ protected static void addBounds (Layer root, Layer l, Rectangle bounds, Point scratch) { float w = l.width(), h = l.height(); if (w != 0 || h != 0) { // grow bounds bounds.add(LayerUtil.layerToParent(l, root, scratch.set(0, 0), scratch)); bounds.add(LayerUtil.layerToParent(l, root, scratch.set(w, h), scratch)); } if (l instanceof GroupLayer) { GroupLayer group = (GroupLayer) l; for (int ii = 0, ll = group.children(); ii < ll; ++ii) { addBounds(root, group.childAt(ii), bounds, scratch); } } } }
@Override public Dimension computeSize (Container<?> elems, float hintX, float hintY) { // report a size large enough to contain all of our elements Rectangle bounds = new Rectangle(); for (Element<?> elem : elems) { if (!elem.isVisible()) continue; Constraint c = constraint(elem); IDimension psize = c.psize(this, elem); bounds.add(new Rectangle(c.pos(0, 0, psize), psize)); } return new Dimension(bounds.width, bounds.height); }