{
// Disables edges as drop targets if the target cell was created
if (dropTarget == null
|| !graph.getModel().isEdge(dropTarget))
{
mxCellState pstate = graph.getView().getState(
dropTarget);
if (pstate != null)
{
mxGeometry geo = graph.getModel()
.getGeometry(vertex);
mxPoint origin = pstate.getOrigin();
geo.setX(geo.getX() - origin.getX());
geo.setY(geo.getY() - origin.getY());
}
}
else
{
dropTarget = graph.getDefaultParent();
}
graph.addCells(new Object[] { vertex }, dropTarget);
}
double x = graph.snap(e.getX());
double y = graph.snap(e.getY());
// FIXME: Here we pre-create the state for the vertex to be
// inserted in order to invoke update in the connectPreview.
// This means we have a cell state which should be created
// after the model.update, so this should be fixed.
mxCellState targetState = graph.getView().getState(
vertex, true);
connectPreview.update(e, targetState, x, y);
}
Object cell = connectPreview.stop(graphComponent