layout icon indicating copy to clipboard operation
layout copied to clipboard

Buggy results from Radial layout with preventOverlap inside a Web Worker

Open louisch opened this issue 8 months ago • 1 comments

Reproduction here: https://stackblitz.com/edit/vitejs-vite-9siuwfqk?file=index.html

When the radial layout algorithm is run with preventOverlap turned on inside a Web Worker, some of the coordinates returned are set to NaN.

Image

louisch avatar Aug 22 '25 08:08 louisch

This is because window.innerWidth and window.innerHeight cannot be accessed inside a Web Worker. https://github.com/antvis/layout/blob/v5/packages/layout/src/radial/index.ts

I have fixed this issue https://github.com/antvis/layout/pull/248. Before the version update, you can manually add width andheight parameters.

const radial = new RadialLayout({
  ...
  width: 1000,
  height: 1000,
});

https://stackblitz.com/edit/vitejs-vite-7ttyzpp3?file=src%2Flayout.ts

zuiidea avatar Sep 11 '25 08:09 zuiidea

感谢你的反馈,也感谢耐心等待 🙏
你提到的这个问题已经在 @antv/[email protected] 中支持了,欢迎升级试用看看~

目前相关的使用方式和 API 可以先参考 Layout 官网文档:
👉 https://layout.antv.vision/

如果在升级或使用过程中遇到任何问题,或者有新的想法,欢迎随时再提 issue 一起讨论。非常感谢你的支持!


Thanks for the feedback, and thanks for your patience 🙏


The issue you mentioned is now supported in @antv/[email protected]. Feel free to upgrade and give it a try. For now, you can refer to the Layout website for usage details and API docs:
👉 https://layout.antv.vision/

If you run into any issues during the upgrade or have new ideas to share, feel free to open a new issue and discuss with us. Thanks a lot for your support!

yvonneyx avatar Dec 31 '25 08:12 yvonneyx