Support Right Click -> Save for animated webp (#6095)

Allow for Right Click -> Save Image to work for the "SaveAnimatedWEBP"
node.

Fixing this revealed other existing issues:
- Attempting to resize the node causes runaway scaling
- Right clicking on the image directly causes a browser context menu
without a save option.

Significant rewriting has been performed to resolve both of these
issues.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6095-Support-Right-Click-Save-for-animated-webp-28e6d73d3650818e85a2ec58c38c2aae)
by [Unito](https://www.unito.io)
This commit is contained in:
AustinMroz
2025-10-16 18:15:23 -07:00
committed by GitHub
parent 984ebef416
commit 1234e1c56d
2 changed files with 33 additions and 32 deletions

View File

@@ -1,3 +1,5 @@
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
import { app } from '../app'
import { $el } from '../ui'
@@ -48,8 +50,8 @@ export function calculateImageGrid(
return { cellWidth, cellHeight, cols, rows, shiftX }
}
// @ts-expect-error fixme ts strict error
export function createImageHost(node) {
/** @knipIgnoreUnusedButUsedByCustomNodes */
export function createImageHost(node: LGraphNode) {
const el = $el('div.comfy-img-preview')
// @ts-expect-error fixme ts strict error
let currentImgs
@@ -108,8 +110,8 @@ export function createImageHost(node) {
}
el.replaceChildren(...imgs)
currentImgs = imgs
node.onResize(node.size)
node.graph.setDirtyCanvas(true, true)
node.onResize?.(node.size)
node.graph?.setDirtyCanvas(true, true)
}
},
getHeight() {