Eliminate constant console deprecation warnings

React Flow 11.10 eliminates the need to use project() and issues a deprecation warning to the console every time that onMouseMove is called (see https://reactflow.dev/whats-new/2023-11-10#rename-usereactflowproject-to-usereactflowscreentoflowposition). This code change eliminates that warning,
This commit is contained in:
Jonathan 2023-12-26 06:51:02 -06:00 committed by psychedelicious
parent 83a9e26cd8
commit c9951cd86b

View File

@ -157,14 +157,11 @@ export const Flow = () => {
}, []);
const onMouseMove = useCallback((event: MouseEvent<HTMLDivElement>) => {
const bounds = flowWrapper.current?.getBoundingClientRect();
if (bounds) {
const pos = $flow.get()?.project({
x: event.clientX - bounds.left,
y: event.clientY - bounds.top,
});
cursorPosition.current = pos;
}
const pos = $flow.get()?.screenToFlowPosition({
x: event.clientX,
y: event.clientY,
});
cursorPosition.current = pos;
}, []);
// #region Updatable Edges