From c9951cd86ba8e9ceeeb783cd292d5a2e0eaae1f3 Mon Sep 17 00:00:00 2001 From: Jonathan <34005131+JPPhoto@users.noreply.github.com> Date: Tue, 26 Dec 2023 06:51:02 -0600 Subject: [PATCH] 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, --- .../web/src/features/nodes/components/flow/Flow.tsx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/Flow.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/Flow.tsx index dc6454b764..e11142b58b 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/Flow.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/Flow.tsx @@ -157,14 +157,11 @@ export const Flow = () => { }, []); const onMouseMove = useCallback((event: MouseEvent) => { - 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