Line data Source code
1 : import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
2 : import type { IImageCompareWidget } from '@comfyorg/graph-model/widgets'
3 : import type {
4 : ImageCompareInputSpec,
5 : InputSpec as InputSpecV2
6 : } from '@comfyorg/object-info-parser/schemas/nodeDefSchemaV2'
7 : import type { ComfyWidgetConstructorV2 } from '@/types/widgetConstructor'
8 :
9 2356 : export const useImageCompareWidget = (): ComfyWidgetConstructorV2 => {
10 2356 : return (node: LGraphNode, inputSpec: InputSpecV2): IImageCompareWidget => {
11 21 : const { name, options = {} } = inputSpec as ImageCompareInputSpec
12 :
13 21 : const widget = node.addWidget('imagecompare', name, ['', ''], () => {}, {
14 : serialize: true,
15 : ...options,
16 : hideInPanel: true
17 : }) as IImageCompareWidget
18 :
19 21 : widget.serialize = false
20 :
21 21 : return widget
22 : }
23 : }
|