mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 19:21:54 +00:00
fix: sync node.imgs on image load for VueNodes context menu
This commit is contained in:
@@ -198,6 +198,8 @@ const handleImageLoad = (event: Event) => {
|
|||||||
if (img.naturalWidth && img.naturalHeight) {
|
if (img.naturalWidth && img.naturalHeight) {
|
||||||
actualDimensions.value = `${img.naturalWidth} x ${img.naturalHeight}`
|
actualDimensions.value = `${img.naturalWidth} x ${img.naturalHeight}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
syncNodeImgs()
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleImageError = () => {
|
const handleImageError = () => {
|
||||||
@@ -207,14 +209,21 @@ const handleImageError = () => {
|
|||||||
actualDimensions.value = null
|
actualDimensions.value = null
|
||||||
}
|
}
|
||||||
|
|
||||||
// In vueNodes mode, we need to set them manually before opening the mask editor.
|
// Sync node.imgs so context menu can detect this as an image node
|
||||||
const setupNodeForMaskEditor = () => {
|
const syncNodeImgs = () => {
|
||||||
if (!props.nodeId || !currentImageEl.value) return
|
if (!props.nodeId || !currentImageEl.value) return
|
||||||
const node = app.rootGraph?.getNodeById(props.nodeId)
|
const node = app.rootGraph?.getNodeById(props.nodeId)
|
||||||
if (!node) return
|
if (!node) return
|
||||||
node.imageIndex = currentIndex.value
|
node.imageIndex = currentIndex.value
|
||||||
node.imgs = [currentImageEl.value]
|
node.imgs = [currentImageEl.value]
|
||||||
app.canvas?.select(node)
|
}
|
||||||
|
|
||||||
|
// In vueNodes mode, we need to set them manually before opening the mask editor.
|
||||||
|
const setupNodeForMaskEditor = () => {
|
||||||
|
syncNodeImgs()
|
||||||
|
if (!props.nodeId) return
|
||||||
|
const node = app.rootGraph?.getNodeById(props.nodeId)
|
||||||
|
if (node) app.canvas?.select(node)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleEditMask = () => {
|
const handleEditMask = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user