X6
X6 copied to clipboard
autoResize 无法同时监听容器宽度和高度变化并自动更新画布大小
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
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.
这是一个 bug,我们尽快修复。
我最近也发现这个bug,所有在做组件封装的时候,放弃了x6提供的autoResize
配置项,而是使用resize-detector
这个包重新写的逻辑
https://github.com/lloydzhou/antv-x6-react/blob/master/src/lib/Graph.tsx#L44
这是一个 bug,我们尽快修复。
修复了吗
同样遇到了这个问题,画布高度无法自适应更新。
同样遇到了这个问题,画布高度无法自适应更新。
别等了,等不到官方修复的。你自己覆盖下 x6 所在容器样式就可以了。
width: auto !important;
height: auto !important;
我也遇到了同样的问题
已经在 2.x 中修复。相关文档。
我发现在火狐93版本复现了该bug,使用的是2.11.4版本的。