We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://x6.antv.vision/en/examples/node/tool#editable 里创建的边上的文字如何隐藏?
例子中能看出来 edge-editor 编辑框是通过 addTools 函数增加的,一个绝对定位在 svg 画布外的编辑框。 因此 hideTools() 隐藏不了编辑框保存后生成的 labels 数组。
目前能看到 Edge 上提供的 Lable 相关的函数只有如下:
appendLabel, getDefaultLabel, getLabelAt, getLabels, insertLabel, labels, onLabelsChanged, parseLabel, removeLabelAt, setLabelAt, setLabels
新增 hideLables() API
The text was updated successfully, but these errors were encountered:
这样hack怎么样?
function hideLabels(edge: Edge) { const data = cloneDeep(edge.getLabels()) data.forEach((label: any) => { label.attrs.label.hideBeforeFontSize = label.attrs.label.fontSize label.attrs.label.fontSize = 0 }) edge.setLabels(data, { overWrite: true, }) } function showLabels(edge: Edge) { const data = cloneDeep(edge.getLabels()) data.forEach((label: any) => { label.attrs.label.fontSize = label.attrs.label.hideBeforeFontSize }) edge.setLabels(data, { overWrite: true, }) }
Sorry, something went wrong.
感谢,很有帮助。但目前我这边用这个方法隐藏后,合并边的多个线段场景下,每个线段都依然会意外保留一个不被隐藏 (就这个的 fontSize 打印的时候是和别的一样被变成 0 了,但是进入到 node_modules/@antv/x6/es/model/edge.js 中的 setLabels 后 labels 变量中每个线段都会有一个 fontSize 并没有赋值成功)。目前不知道是我自己的原因还是 x6 的什么原因,还需要继续排查。
No branches or pull requests
功能描述
https://x6.antv.vision/en/examples/node/tool#editable 里创建的边上的文字如何隐藏?
例子中能看出来 edge-editor 编辑框是通过 addTools 函数增加的,一个绝对定位在 svg 画布外的编辑框。
因此 hideTools() 隐藏不了编辑框保存后生成的 labels 数组。
目前能看到 Edge 上提供的 Lable 相关的函数只有如下:
期望解决方案
新增 hideLables() API
The text was updated successfully, but these errors were encountered: