[BugFix] Fix incorrect selection overlay after drag (#2658)

This commit is contained in:
Chenlei Hu
2025-02-20 20:12:42 -05:00
committed by GitHub
parent c3c6ec627b
commit 8074d797b0

View File

@@ -76,9 +76,17 @@ watch(
watch(
() => canvasStore.canvas?.state?.draggingItems,
(draggingItems) => {
visible.value = !draggingItems
// Litegraph draggingItems state can end early before the bounding boxes of
// the selected items are updated. Delay to make sure we put the overlay in
// the correct position.
// https://github.com/Comfy-Org/ComfyUI_frontend/issues/2656
if (draggingItems === false) {
positionSelectionOverlay(canvasStore.canvas as LGraphCanvas)
setTimeout(() => {
visible.value = true
positionSelectionOverlay(canvasStore.canvas as LGraphCanvas)
}, 100)
} else {
visible.value = false
}
}
)