antvis/G6

[Bug]: The initialization is a collapsed combo, and the first time you drag it, it will flash directly to the upper left corner. #6722

huawei668 posted onGitHub

Describe the bug / 问题描述

import { Graph } from '@antv/g6';

fetch('https://assets.antv.antgroup.com/g6/cluster.json') .then((res) => res.json()) .then((data) => { data.nodes.forEach(item=>{ if(item.data.cluster == 'd'){ item.combo = 'dd' } }) data.combos = [{id:'dd',style:{collapsed:true}}] const graph = new Graph({ container: 'container', data, node: { style: { labelText: (d) => d.id, labelBackground: true, }, palette: { type: 'group', field: 'cluster', }, }, layout: { type: 'grid', sortBy: 'id', nodeSize: 32, }, behaviors: ['zoom-canvas', 'drag-canvas', 'drag-element'], });

graph.render();

window.addPanel((gui) => {
  gui.add({ sortBy: 'id' }, 'sortBy', ['id', 'cluster']).onChange((type) => {
    graph.setLayout({
      type: 'grid',
      sortBy: type,
    });
    graph.layout();
  });
});

});

No response

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

上面代码是依据G6官网的示例改造。 复现步骤: 1、复制以上代码运行后 2、拖拽那个折叠的combo

G6 Version / G6 版本

🆕 5.x

OS / 操作系统

  • macOS
  • Windows
  • Linux
  • Others / 其他

Browser / 浏览器

  • Chrome
  • Edge
  • Firefox
  • Safari (Limited support / 有限支持)
  • IE (Nonsupport / 不支持)
  • Others / 其他

Fund this Issue

$0.00
Funded

Pull requests