public void constrainChild(Object cell){
  if (cell != null) {
    mxGeometry geo=model.getGeometry(cell);
    mxRectangle area=(isConstrainChild(cell)) ? getCellContainmentArea(cell) : getMaximumGraphBounds();
    if (geo != null && area != null) {
      if (!geo.isRelative() && (geo.getX() < area.getX() || geo.getY() < area.getY() || area.getWidth() < geo.getX() + geo.getWidth() || area.getHeight() < geo.getY() + geo.getHeight())) {
        double overlap=getOverlap(cell);
        if (area.getWidth() > 0) {
          geo.setX(Math.min(geo.getX(),area.getX() + area.getWidth() - (1 - overlap) * geo.getWidth()));
        }
        if (area.getHeight() > 0) {
          geo.setY(Math.min(geo.getY(),area.getY() + area.getHeight() - (1 - overlap) * geo.getHeight()));
        }
        geo.setX(Math.max(geo.getX(),area.getX() - geo.getWidth() * overlap));
        geo.setY(Math.max(geo.getY(),area.getY() - geo.getHeight() * overlap));
      }
    }
  }
}

public void constrainChild ( Object cell ) { if ( cell != null ) { mxGeometry geo = model . getGeometry ( cell ) ; mxRectangle area = ( isConstrainChild ( cell ) ) ? getCellContainmentArea ( cell ) : getMaximumGraphBounds ( ) ; if ( geo != null && area != null ) { if ( ! geo . isRelative ( ) && ( geo . getX ( ) < area . getX ( ) || geo . getY ( ) < area . getY ( ) || area . getWidth ( ) < geo . getX ( ) + geo . getWidth ( ) || area . getHeight ( ) < geo . getY ( ) + geo . getHeight ( ) ) ) { double overlap = getOverlap ( cell ) ; if ( area . getWidth ( ) > 0 ) { geo . setX ( Math . min ( geo . getX ( ) , area . getX ( ) + area . getWidth ( ) - ( 1 - overlap ) * geo . getWidth ( ) ) ) ; } if ( area . getHeight ( ) > 0 ) { geo . setY ( Math . min ( geo . getY ( ) , area . getY ( ) + area . getHeight ( ) - ( 1 - overlap ) * geo . getHeight ( ) ) ) ; } geo . setX ( Math . max ( geo . getX ( ) , area . getX ( ) - geo . getWidth ( ) * overlap ) ) ; geo . setY ( Math . max ( geo . getY ( ) , area . getY ( ) - geo . getHeight ( ) * overlap ) ) ; } } } }
keeps the given cell inside the bounds returned by getcellcontainmentarea for its parent , according to the rules defined by getoverlap and isconstrainchild . this modifies the cell ' s geometry in - place and does not clone it .
