Skip to content

Commit 96d1233

Browse files
authored
Fix: Toolbox position desync (#6962)
## 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)
1 parent 4b87b1f commit 96d1233

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/composables/canvas/useSelectionToolboxPosition.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useElementBounding, useRafFn } from '@vueuse/core'
2-
import { computed, onUnmounted, ref, watch } from 'vue'
2+
import { computed, onUnmounted, ref, watch, watchEffect } from 'vue'
33
import type { Ref } from 'vue'
44

55
import { useSelectedLiteGraphItems } from '@/composables/canvas/useSelectedLiteGraphItems'
@@ -157,6 +157,14 @@ export function useSelectionToolboxPosition(
157157
// Sync with canvas transform
158158
const { resume: startSync, pause: stopSync } = useRafFn(updateTransform)
159159

160+
watchEffect(() => {
161+
if (visible.value) {
162+
startSync()
163+
} else {
164+
stopSync()
165+
}
166+
})
167+
160168
// Watch for selection changes
161169
watch(
162170
() => canvasStore.getCanvas().state.selectionChanged,
@@ -173,11 +181,6 @@ export function useSelectionToolboxPosition(
173181
}
174182
updateSelectionBounds()
175183
canvasStore.getCanvas().state.selectionChanged = false
176-
if (visible.value) {
177-
startSync()
178-
} else {
179-
stopSync()
180-
}
181184
}
182185
},
183186
{ immediate: true }

0 commit comments

Comments
 (0)