实现效果
![](https://img-blog.csdnimg.cn/958c2fd12ae14f4e87565186ef3bb9fa.png)
实现代码
选中时运动
graph.on("node:selected", ({ node }) => {
/* 获取连出的线 */
const connectEdges = graph.getConnectedEdges(node, { outgoing: true });
connectEdges.map((edge) => {
/* 获取边的长度 */
const view = graph.findViewByCell(edge) as EdgeView;
const length = view.path.length();
/* 小球个数 */
const circleNum = Math.ceil(length / 100);
/* 图形 */
let markup = edge.getMarkup();
const attrOption: IObjectAny = {
circleGroup: {
r: 3,
fill: '#db5e5e',
},
};
/* 图形个数 */
for (let i = 0; i < circleNum; i++) {
const selector = 'circle' + i + edge.id
markup = [