antvG6,拖拽节点不生效解决办法

const graph = new G6.Graph({
  modes: {
    default: ['drag-node'],
  },
});

3.2版本的 g6,解决方法是给拖拽的节点调用方法 .set(‘capture’,false);

const rect = group.addShape("rect", {
                      attrs: {
                          y: moveY,
                          height:30,
                          stroke: "#E4E7ED",
                          fill: "#4091F7",
                          opacity: 0.1,
                      },
                      name:'rect-shape2'
                  });
                 rect..set(‘capture’,false)

3.7版本以后的在创建节点时添加属性 draggable: true,

const rect = group.addShape("rect", {
                      attrs: {
                          y: moveY,
                          height:30,
                          stroke: "#E4E7ED",
                          fill: "#4091F7",
                          opacity: 0.1,
                      },
                      draggable: true,
                      name:'rect-shape2'
                  });

你可能感兴趣的:(antv,G6,前端,antv,G6)