请问,插件minimap的shape怎么绘制edge #6616
Unanswered
TiggerYuan
asked this question in
Q&A
Replies: 2 comments
-
|
Beta Was this translation helpful? Give feedback.
0 replies
-
shape支持返回 @antv/g的DisplayObject,不建议使用 G6 自带的图形,G6 的图形使用需要有 graph 的 context 来获取其他节点信息。 if (elementType === 'edge') {
const edgeData = graph.getElementData(id);
const startPoint = graph.getElementPosition(edgeData.style!.sourceNode);
const endPoint = graph.getElementPosition(edgeData.style!.targetNode);
return new GLine({
style: {
x1: startPoint[0],
y1: startPoint[1],
x2: endPoint[0],
y2: endPoint[1],
stroke: '#C4CDE3',
lineWidth: 2,
lineDash: graph.getElementRenderStyle(id).lineDash,
},
});
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
我采用
new GLine({id})
的方式重新绘制,控制台会报错this.context is undefined get sourceNode base-edge.ts:222
,如果我使用filter过滤只渲染node,然后渲染时用new Rect({id})
来渲染node就没有上面的错误,是渲染边时有要特殊处理吗?Beta Was this translation helpful? Give feedback.
All reactions