Last updated on
2023-11-10
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 to useReactFlow.screenToFlowPosition⚠️ changes: no need to subtract react flow bounds anymore!
before:
const reactFlowBounds = reactFlowWrapper.current.getBoundingClientRect();
const position
after:
const position = reactFlowInstance.screenToFlowPosition({
x: event.clientX,
y: event.clientY,
});⚠️ changes: returns { x: number, y: number, zoom: number } instead of [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);no changes, just a renaming.
useReactFlow.flowToScreenPosition for completionBesides that we fixed some bugs 🐛 You can find all change in the v11.10.0 Github release .