自定义节点在focusItem时无法获取到矩形,getMatrix为null #4198
lmm2022 posted onGitHub
Describe the bug
自定义节点代码
// 自定义节点(带删除按钮的长方形)
G6.registerNode(
'deletedRect',
{
afterDraw(cfg, group) {
const x = 30
const y = -20
const bottomNode = group.addShape('rect', {
attrs: {
stroke: 'white',
fill: 'white',
x: x - 1,
y: y - 4,
width: 20,
height: 20,
zIndex: 0,
capture: true,
radius: 10,
lineWidth: 1
},
name: 'deletedNode'
})
const deleteNode = group.addShape('path', {
attrs: {
stroke: '#000',
zIndex: 2,
path: [
['M', 0 + x, 0 + y],
['L', 10 + x, 10 + y],
['M', 0 + x, 10 + y],
['L', 10 + x, 0 + y]
],
capture: true,
lineWidth: 2
},
name: 'deletedNode'
})
return deleteNode, bottomNode
},
// 响应状态变化(修复单击后样式重叠的官方bug 勿动)
setState(name, value, item) {
const group = item.getContainer()
const shape = group.get('children')[0] // 顺序根据 draw 时确定
}
},
'rect'
Your Example Website or App
暂无
Steps to Reproduce the Bug or Issue
在上面截图和自定义节点代码显现
Expected behavior
我不清除我是不是还需要定义matrix 但是看官方文档那是3.3版本 我现在是处于4.7.14版本的antv/G6
Screenshots or Videos
No response
Platform
- OS: [e.g. macOS, Windows, Linux]
- Browser: [e.g. Chrome, Safari, Firefox]
- Version: [e.g. 91.1]
Additional context
No response