mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 10:42:44 +00:00
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)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { useElementBounding, useRafFn } from '@vueuse/core'
|
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 type { Ref } from 'vue'
|
||||||
|
|
||||||
import { useSelectedLiteGraphItems } from '@/composables/canvas/useSelectedLiteGraphItems'
|
import { useSelectedLiteGraphItems } from '@/composables/canvas/useSelectedLiteGraphItems'
|
||||||
@@ -157,6 +157,14 @@ export function useSelectionToolboxPosition(
|
|||||||
// Sync with canvas transform
|
// Sync with canvas transform
|
||||||
const { resume: startSync, pause: stopSync } = useRafFn(updateTransform)
|
const { resume: startSync, pause: stopSync } = useRafFn(updateTransform)
|
||||||
|
|
||||||
|
watchEffect(() => {
|
||||||
|
if (visible.value) {
|
||||||
|
startSync()
|
||||||
|
} else {
|
||||||
|
stopSync()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// Watch for selection changes
|
// Watch for selection changes
|
||||||
watch(
|
watch(
|
||||||
() => canvasStore.getCanvas().state.selectionChanged,
|
() => canvasStore.getCanvas().state.selectionChanged,
|
||||||
@@ -173,11 +181,6 @@ export function useSelectionToolboxPosition(
|
|||||||
}
|
}
|
||||||
updateSelectionBounds()
|
updateSelectionBounds()
|
||||||
canvasStore.getCanvas().state.selectionChanged = false
|
canvasStore.getCanvas().state.selectionChanged = false
|
||||||
if (visible.value) {
|
|
||||||
startSync()
|
|
||||||
} else {
|
|
||||||
stopSync()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
|
|||||||
Reference in New Issue
Block a user