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

  • Post author:
  • Post category:其他


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'
                  });



版权声明:本文为weixin_38345306原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。