From 8df5447563e28592c6b507c790eded3cbc01913c Mon Sep 17 00:00:00 2001
From: psychedelicious <4822129+psychedelicious@users.noreply.github.com>
Date: Tue, 20 Aug 2024 10:17:21 +1000
Subject: [PATCH] fix(ui): only update stage attrs when stage itself is dragged

---
 .../web/src/features/controlLayers/konva/events.ts    | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/invokeai/frontend/web/src/features/controlLayers/konva/events.ts b/invokeai/frontend/web/src/features/controlLayers/konva/events.ts
index 8058f2ba23..084faaf650 100644
--- a/invokeai/frontend/web/src/features/controlLayers/konva/events.ts
+++ b/invokeai/frontend/web/src/features/controlLayers/konva/events.ts
@@ -522,7 +522,10 @@ export const setStageEventHandlers = (manager: CanvasManager): (() => void) => {
   });
 
   //#region dragmove
-  stage.on('dragmove', () => {
+  stage.on('dragmove', (e) => {
+    if (e.target !== stage) {
+      return;
+    }
     $stageAttrs.set({
       x: Math.floor(stage.x()),
       y: Math.floor(stage.y()),
@@ -533,8 +536,10 @@ export const setStageEventHandlers = (manager: CanvasManager): (() => void) => {
   });
 
   //#region dragend
-  stage.on('dragend', () => {
-    // Stage position should always be an integer, else we get fractional pixels which are blurry
+  stage.on('dragend', (e) => {
+    if (e.target !== stage) {
+      return;
+    } // Stage position should always be an integer, else we get fractional pixels which are blurry
     $stageAttrs.set({
       x: Math.floor(stage.x()),
       y: Math.floor(stage.y()),