From f6664960caa1f2431c1ff1acd83ab9f53816d7dd Mon Sep 17 00:00:00 2001 From: Jonathan <34005131+JPPhoto@users.noreply.github.com> Date: Tue, 26 Dec 2023 08:14:22 -0600 Subject: [PATCH] Update useBuildNode.ts Added addition of the rect's top left coordinates to get equivalent behavior. --- .../frontend/web/src/features/nodes/hooks/useBuildNode.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/invokeai/frontend/web/src/features/nodes/hooks/useBuildNode.ts b/invokeai/frontend/web/src/features/nodes/hooks/useBuildNode.ts index d4ebe8289b..c4e82d4436 100644 --- a/invokeai/frontend/web/src/features/nodes/hooks/useBuildNode.ts +++ b/invokeai/frontend/web/src/features/nodes/hooks/useBuildNode.ts @@ -38,11 +38,11 @@ export const useBuildNode = () => { ?.getBoundingClientRect(); if (rect) { - _x = rect.width / 2 - NODE_WIDTH / 2; - _y = rect.height / 2 - NODE_WIDTH / 2; + _x = rect.width / 2 - NODE_WIDTH / 2 + rect.left; + _y = rect.height / 2 - NODE_WIDTH / 2 + rect.top; } - const position = flow.project({ + const position = flow.screenToFlowPosition({ x: _x, y: _y, });