X6 icon indicating copy to clipboard operation
X6 copied to clipboard

autoResize 无法同时监听容器宽度和高度变化并自动更新画布大小

Open wb-wenbei opened this issue 2 years ago • 4 comments

Describe the bug

autoResize属性设置为true,外容器设置css属性display:flex; 容器宽度变化时可以自动更新画布大小,但是容器高度变化时无法自动更新画布大小

Your Example Website or App

https://codesandbox.io/s/adoring-resonance-i3tfxv?file=/src/app.tsx

Steps to Reproduce the Bug or Issue

1.打开测试页面:地址 2.拖动页面中黄色横条改变下方容器大小; 3.画布并没有跟着下方容器尺寸改变而自动更新画布大小;

Expected behavior

随下方容器尺寸改变而自动更新画布大小。

Screenshots or Videos

No response

Platform

  • OS: [macOS]
  • Browser: [Chrome]
  • Version: [103.0.5060.114]

Additional context

外部容器设置css属性:display:flex时,画布只能自动更新宽度, 外部容器设置css属性:display:flex;flex-direction: column;时,画布只能自动更新高度, 无法宽高同时自动更新。

wb-wenbei avatar Jul 29 '22 09:07 wb-wenbei

👋 @wb-wenbei

Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

x6-bot[bot] avatar Jul 29 '22 09:07 x6-bot[bot]

这是一个 bug,我们尽快修复。

NewByVector avatar Aug 01 '22 21:08 NewByVector

我最近也发现这个bug,所有在做组件封装的时候,放弃了x6提供的autoResize配置项,而是使用resize-detector这个包重新写的逻辑

https://github.com/lloydzhou/antv-x6-react/blob/master/src/lib/Graph.tsx#L44

lloydzhou avatar Aug 31 '22 14:08 lloydzhou

这是一个 bug,我们尽快修复。

修复了吗

zzjjbbaa avatar Sep 08 '22 03:09 zzjjbbaa

同样遇到了这个问题,画布高度无法自适应更新。

mtiger95 avatar Nov 15 '22 02:11 mtiger95

同样遇到了这个问题,画布高度无法自适应更新。

别等了,等不到官方修复的。你自己覆盖下 x6 所在容器样式就可以了。

width: auto !important;
height: auto !important;

pfdgithub avatar Nov 15 '22 09:11 pfdgithub

我也遇到了同样的问题

hujinbo avatar Dec 13 '22 09:12 hujinbo

已经在 2.x 中修复。相关文档

NewByVector avatar Jan 31 '23 03:01 NewByVector

我发现在火狐93版本复现了该bug,使用的是2.11.4版本的。

zeffon avatar Jul 21 '23 03:07 zeffon