From 96d12330bb0f2c53b7e27bde23743b7caabf8763 Mon Sep 17 00:00:00 2001 From: Alexander Brown Date: Wed, 26 Nov 2025 11:43:58 -0800 Subject: [PATCH] Fix: Toolbox position desync (#6962) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Toggle the toolbox position check based on visibility, not just when selection changes. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6962-Fix-Toolbox-position-desync-2b76d73d3650818da327c7adee6c1098) by [Unito](https://www.unito.io) --- .../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 }