这段代码怎么改坐标,使线不重叠
graph.stylesheet.getDefaultEdgeStyle()[mxConstants.STYLE_EDGE] =
mxEdgeStyle.MyStyle = function(state, source, target, points, result)
{
var view = state.view;
var pt = (points != null && points.length > 0) ? points[0] : null;
var pts = state.absolutePoints;
var p0 = pts[0];
var pe = pts[pts.length-1];
if (pt != null)
{
pt = view.transformControlPoint(state, pt);
}
if (p0 != null)
{
source = new mxCellState();
source.x = p0.x;
source.y = p0.y;
}
if (pe != null)
{
target = new mxCellState();
target.x = pe.x;
target.y = pe.y;
}
if (source != null && target != null)
{
var l = Math.max(source.x, target.x);
var r = Math.min(source.x + source.width,
target.x + target.width);
var x = (pt != null) ? pt.x : r + (l - r) / 2;
var y1 = view.getRoutingCenterY(source);
var y2 = view.getRoutingCenterY(target);
if (pt != null)
{
if (pt.y >= source.y && pt.y <= source.y + source.height)
{
y1 = pt.y;
}
if (pt.y >= target.y && pt.y <= target.y + target.height)
{
y2 = pt.y;
}
}
if (!mxUtils.contains(target, x, y1) &&
!mxUtils.contains(source, x, y1))
{
result.push(new mxPoint(x, y1));
}
if (!mxUtils.contains(target, x, y2) &&
!mxUtils.contains(source, x, y2))
{
result.push(new mxPoint(x, y2));
}
if (result.length == 1)
{
if (pt != null)
{
if (!mxUtils.contains(target, x, pt.y) &&
!mxUtils.contains(source, x, pt.y))
{
result.push(new mxPoint(x, pt.y));
}
}
else
{
var t = Math.max(source.y, target.y);
var b = Math.min(source.y + source.height,
target.y + target.height);
result.push(new mxPoint(x, t + (b - t) / 2));
}
}
}
};