// Clones the cell state and updates the absolute points using
// the current state of this handle. This is required for
// computing the correct perimeter points and edge style.
mxGeometry geometry = graphComponent.getGraph()
.getCellGeometry(state.getCell());
mxCellState clone = (mxCellState) state.clone();
List<mxPoint> points = geometry.getPoints();
mxGraphView view = clone.getView();
if (isSource || isTarget)
{
marker.process(e);
mxCellState currentState = marker.getValidState();
target = view
.getVisibleTerminal(state.getCell(), !isSource);
if (currentState != null)
{
source = currentState.getCell();
}
else
{
mxPoint pt = new mxPoint(e.getPoint());
if (gridEnabledEvent)
{
pt = graphComponent.snapScaledPoint(pt);
}
clone.setAbsoluteTerminalPoint(pt, isSource);
}
if (!isSource)
{
Object tmp = source;
source = target;
target = tmp;
}
}
else
{
mxPoint point = convertPoint(new mxPoint(e.getPoint()),
gridEnabledEvent);
if (points == null)
{
points = Arrays.asList(new mxPoint[] { point });
}
else if (index - 1 < points.size())
{
points = new ArrayList<mxPoint>(points);
points.set(index - 1, point);
}
source = view.getVisibleTerminal(state.getCell(), true);
target = view.getVisibleTerminal(state.getCell(), false);
}
// Computes the points for the edge style and terminals
mxCellState sourceState = view.getState(source);
mxCellState targetState = view.getState(target);
mxConnectionConstraint sourceConstraint = graphComponent
.getGraph().getConnectionConstraint(clone, sourceState,
true);
mxConnectionConstraint targetConstraint = graphComponent