antvis/G6


The issue has been closed
[Bug]: Custom nodes cannot be dragged and dropped #6690
uioonm posted onGitHub
Describe the bug / 问题描述
使用文档的自定义节点,节点无法拖拽 以下代码复制到图表示例内可以复现
import { ExtensionCategory, Graph, register } from '@antv/g6';
import { CustomElement, Circle } from '@antv/g';
class CustomCircle extends CustomElement {
constructor(options) {
super(options);
this.render();
}
render() {
const { radius } = this.attributes;
const circle = new Circle({
style: {
...this.attributes,
x: 0,
y: 0,
r: radius,
},
});
this.appendChild(circle);
}
}
register(ExtensionCategory.NODE, 'custom-circle', CustomCircle);
const graph = new Graph({
container: 'container',
data: {
nodes: [
{
type: 'custom-circle',
id: 'node-1',
style: { x: 100, y: 100, radius: 25 },
},
{
type: 'custom-circle',
id: 'node-2',
data: { name: 'Process', type: 'process', status: 'error', success: 11, time: 12, failure: 26 },
style: { x: 300, y: 100, radius: 25 },
},
],
edges: [{ source: 'node-1', target: 'node-2' }],
},
behaviors: ['drag-element', 'zoom-canvas', 'drag-canvas'],
});
graph.render();
Reproduction link / 复现链接
No response
Steps to Reproduce the Bug or Issue / 重现步骤
No response
G6 Version / G6 版本
🆕 5.x
OS / 操作系统
- macOS
- Windows
- Linux
- Others / 其他
Browser / 浏览器
- Chrome
- Edge
- Firefox
- Safari (Limited support / 有限支持)
- IE (Nonsupport / 不支持)
- Others / 其他