edge = graph.insertEdge(parent,
null,
'',
vertex1,
vertex2);
var destX = vertex2.geometry.x;
var destY = vertex2.geometry.y;
var destHeight = vertex2.geometry.height;
var sourceX = vertex2.geometry.x;
var sourceY = vertex2.geometry.y;
var sourceHeight = vertex2.geometry.height;
edge.geometry.setTerminalPoint(new
mxPoint(sourceX,sourceY+(sourceHeight/2)),true);
edge.geometry.setTerminalPoint(new
mxPoint(destX,destY+(destHeight/2)),false);
edge.geometry.relative = true;
这将创建默认边。请假定已插入顶点。
答案 0 :(得分:0)
仅当边缘未连接时才需要终端点,并且终端点分别存储在sourcePoint>和targetPoint变量中。
https://jgraph.github.io/mxgraph/docs/js-api/files/model/mxGeometry-js.html#mxGeometry