Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In the comboCombined layout, after the dagre direction is changed from rankdir: 'LR' to rankdir: 'TB', and then the combo node is expanded, the position of the combo expansion is still the previous position? #6359

Open
licc12 opened this issue Sep 23, 2024 · 1 comment
Labels

Comments

@licc12
Copy link

licc12 commented Sep 23, 2024

Describe the bug / 问题描述

comboCombined 布局中, dagre方向由 rankdir: 'LR' 切换为 rankdir: 'TB' 后,再展开combo节点,此时combo展开的位置还是之前的位置:

期望:combo展开的位置与折叠状态的位置一致,而不是切换方向前的位置;

const graph = new G6.Graph({
  container: 'container',
  width,
  height,
  layout: {
        animate: true,
        type: 'comboCombined',
        sortByCombo: false,
        collapsed: true,
        innerLayout: new G6.Layout.grid({
          collapsed: true,
        }),
        minZoom: 1,
        maxZoom: 1,
        outerLayout: new G6.Layout.dagre({
          nodesep: 30, // 节点间距
          ranksep: 60, // 层间距
          nodeSize: 30,
          minZoom: 1,
          maxZoom: 2.5,
          rankdir: 'LR',
          linkDistance: 50,
          controlPoints: true, // 可选
          preventOverlap: false,
        }),
        comboPadding: 20,
      },
  });

image

Reproduction link / 重现链接

https://codesandbox.io/p/sandbox/musing-herschel-r2dk4x

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

  1. 切换dagre的方向
  2. 点击combo展开
  3. 此时可看到combo位置不对

G6 Version / G6 版本

4.x

Operating System / 操作系统

macOS

Browser / 浏览器

Chrome

Additional context / 补充说明

G6版本:
"@antv/g6": "^4.8.23"

@github-actions github-actions bot changed the title comboCombined 布局中dagre切换方向后Combo节点展开的位置还是之前的位置? In the comboCombined layout, is the combo node expanded after the dagre changes direction or the position before? Sep 23, 2024
@licc12 licc12 changed the title In the comboCombined layout, is the combo node expanded after the dagre changes direction or the position before? comboCombined 布局中, dagre方向由 rankdir: 'LR' 切换为 rankdir: 'TB' 后,再展开combo节点,此时combo展开的位置还是之前的位置? Sep 23, 2024
@github-actions github-actions bot changed the title comboCombined 布局中, dagre方向由 rankdir: 'LR' 切换为 rankdir: 'TB' 后,再展开combo节点,此时combo展开的位置还是之前的位置? In the comboCombined layout, after the dagre direction is changed from rankdir: 'LR' to rankdir: 'TB', and then the combo node is expanded, the position of the combo expansion is still the previous position? Sep 23, 2024
@licc12
Copy link
Author

licc12 commented Sep 23, 2024

经过尝试,需要将relayout: true开启,就不用graph.render()强制刷新,但是会导致combo重新布局:又会引起另一个问题,combo展开前先拖拽到其它位置,再点击展开,此时可能由于重新布局的原因,combo的位置不在拖动后的位置了、、、

 modes: {
      default: [
        {
          type: 'collapse-expand-combo',
          trigger: 'click',
          relayout: true, // 收缩展开后,重新布局
        },


....

@yvonneyx yvonneyx added the v4 label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants