From 0e757b88fa3a17a69eed99d8194adf12a18248fb Mon Sep 17 00:00:00 2001 From: Comfy Org PR Bot Date: Tue, 9 Dec 2025 08:26:50 +0900 Subject: [PATCH] [backport core/1.33] Fix: Toolbox position desync (#7241) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport of #6962 to `core/1.33` Automatically created by backport workflow. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7241-backport-core-1-33-Fix-Toolbox-position-desync-2c36d73d3650810bb77bdd720976a119) by [Unito](https://www.unito.io) Co-authored-by: Alexander Brown --- .../canvas/useSelectionToolboxPosition.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/composables/canvas/useSelectionToolboxPosition.ts b/src/composables/canvas/useSelectionToolboxPosition.ts index 8296ee955..0d15b3a12 100644 --- a/src/composables/canvas/useSelectionToolboxPosition.ts +++ b/src/composables/canvas/useSelectionToolboxPosition.ts @@ -1,5 +1,5 @@ import { useElementBounding, useRafFn } from '@vueuse/core' -import { computed, onUnmounted, ref, watch } from 'vue' +import { computed, onUnmounted, ref, watch, watchEffect } from 'vue' import type { Ref } from 'vue' import { useSelectedLiteGraphItems } from '@/composables/canvas/useSelectedLiteGraphItems' @@ -157,6 +157,14 @@ export function useSelectionToolboxPosition( // Sync with canvas transform const { resume: startSync, pause: stopSync } = useRafFn(updateTransform) + watchEffect(() => { + if (visible.value) { + startSync() + } else { + stopSync() + } + }) + // Watch for selection changes watch( () => canvasStore.getCanvas().state.selectionChanged, @@ -173,11 +181,6 @@ export function useSelectionToolboxPosition( } updateSelectionBounds() canvasStore.getCanvas().state.selectionChanged = false - if (visible.value) { - startSync() - } else { - stopSync() - } } }, { immediate: true }