antvis/G6

jsx 自定义节点无法进行拖拽 #5916

hancao97 posted onGitHub

Describe the bug / 问题描述

如下方式注册的节点在配置了 drag-node 仍无法支撑节点拖拽, 考虑在定义中添加 draggable = “true” 仍然无法生效 G6.registerNode( 'dscp-data-flow-standrad-node', (cfg) => { const nodeConfig = getNodeConfig(cfg); return <group> <rect style={{ width: 54, height: 54, }} name="dataFlowNodeKeyShapeWrapper" > <circle style={{ marginTop: 27, marginLeft: 55, r: 27, fill: '${nodeConfig.wrapperFill}', stroke: '${nodeConfig.wrapperStroke}', lineWidth: 2, opacity: 0, cursor: 'pointer' }} keyshape="true" name="dataFlowNodeKeyShape" > <image style={{ marginTop: -22, marginLeft: 32, width: 45, height: 45, cursor: 'pointer', img: '${nodeConfig.imgSrc}' }} name="dataFlowNodeImg" > </image> </circle> </rect> <rect style={{ marginTop: 4, marginLeft: ${48 - nodeConfig.label.length * 5}, width: ${14 + nodeConfig.label.length * 10}, height: 20, fill: '${nodeConfig.themeColor}', opacity: 0, radius: 5 }} name="dataFlowNodeLabelWrapper" > <text style={{ marginLeft: 55, marginTop: 2, textAlign: 'center', fontWeight: 'bold', fill: '${nodeConfig.textFill}', cursor: 'pointer', fontSize: 16, fontFamily: 'monospace' }} name="dataFlowNodeLabel" >${nodeConfig.label}</text> </rect> </group>; } );

No response

Steps to Reproduce the Bug or Issue / 重现步骤

No response

G6 Version / G6 版本

4.x

Operating System / 操作系统

macOS

Browser / 浏览器

Chrome

Additional context / 补充说明

No response


我同时使用了combo 布局,但是经过验证和 combo 无关

posted by hancao97 10 months ago

我发现了, 居然是层级的问题, 需要把最上层的改为 draggable true

posted by hancao97 10 months ago

Fund this Issue

$0.00
Funded

Pull requests