state.getOrigin().setY(0);
state.setLength(0);
if (state.getCell() != currentRoot)
{
mxIGraphModel model = graph.getModel();
mxCellState pState = getState(model.getParent(state.getCell()));
if (pState != null && pState.getCell() != currentRoot)
{
state.getOrigin().setX(
state.getOrigin().getX() + pState.getOrigin().getX());
state.getOrigin().setY(
state.getOrigin().getY() + pState.getOrigin().getY());
}
mxPoint offset = graph.getChildOffsetForCell(state.getCell());
if (offset != null)
{
state.getOrigin()
.setX(state.getOrigin().getX() + offset.getX());
state.getOrigin()
.setY(state.getOrigin().getY() + offset.getY());
}
mxGeometry geo = graph.getCellGeometry(state.getCell());
if (geo != null)
{
if (!model.isEdge(state.getCell()))
{
mxPoint origin = state.getOrigin();
offset = geo.getOffset();
if (offset == null)
{
offset = EMPTY_POINT;
}
if (geo.isRelative() && pState != null)
{
if (model.isEdge(pState.getCell()))
{
mxPoint orig = getPoint(pState, geo);
if (orig != null)
{
origin.setX(origin.getX()
+ (orig.getX() / scale) - pState.getOrigin().getX()
- translate.getX());
origin.setY(origin.getY()
+ (orig.getY() / scale) - pState.getOrigin().getY()
- translate.getY());
}
}
else
{
origin.setX(origin.getX() + geo.getX()
* pState.getWidth() / scale + offset.getX());
origin.setY(origin.getY() + geo.getY()
* pState.getHeight() / scale
+ offset.getY());
}
}
else
{
state.setAbsoluteOffset(new mxPoint(scale
* offset.getX(), scale * offset.getY()));
origin.setX(origin.getX() + geo.getX());
origin.setY(origin.getY() + geo.getY());
}
}
state.setX(scale
* (translate.getX() + state.getOrigin().getX()));
state.setY(scale
* (translate.getY() + state.getOrigin().getY()));
state.setWidth(scale * geo.getWidth());
state.setHeight(scale * geo.getHeight());
if (model.isVertex(state.getCell()))
{
updateVertexState(state, geo);
}
if (model.isEdge(state.getCell()))
{
updateEdgeState(state, geo);
}
// Updates the cached label