Skip to Content

2023-11-10

新版本 11.10.0!

Moritz Klack
Co-Founder

我们希望 v12 的迁移尽可能顺利。这就是为什么我们为以下工具函数添加了弃用警告的原因:

🌐 We want to make the migration for v12 as smooth as possible. That’s why we added deprecation warnings for the following util functions:

useReactFlow.project 重命名为 useReactFlow.screenToFlowPosition

🌐 Rename useReactFlow.project to useReactFlow.screenToFlowPosition

⚠️ 更改:不再需要减去 React Flow 的边界!

before:

const reactFlowBounds = reactFlowWrapper.current.getBoundingClientRect(); const position = reactFlowInstance.project({ x: event.clientX - reactFlowBounds.left, y: event.clientY - reactFlowBounds.top, });

after:

const position = reactFlowInstance.screenToFlowPosition({ x: event.clientX, y: event.clientY, });

getTransformForBounds 重命名为 getViewportForBounds

🌐 Rename getTransformForBounds to getViewportForBounds

⚠️ 更改:返回 { x: number, y: number, zoom: number } 而不是 [number, number, number]

before:

const [x, y, zoom] = getTransformForBounds(bounds, width, height, 0.5, 2);

after:

const { x, y, zoom } = getViewportForBounds(bounds, width, height, 0.5, 2);

getRectOfNodes 重命名为 getNodesBounds

🌐 Rename getRectOfNodes to getNodesBounds

没有变化,只是改名。

🌐 no changes, just a renaming.

新功能

🌐 New features

  • 添加了 useReactFlow.flowToScreenPosition 以完成

除此之外,我们修复了一些错误 🐛 你可以在 v11.10.0 Github 发布  中找到所有更改。

🌐 Besides that we fixed some bugs 🐛 You can find all change in the v11.10.0 Github release .

Get Pro examples, prioritized bug reports, 1:1 support from the maintainers, and more with React Flow Pro

Last updated on