mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-28 18:54:09 +00:00
Draw canvas image preview in a widget (#2952)
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
import type { ColorOption } from '@comfyorg/litegraph'
|
||||
import {
|
||||
LGraphGroup,
|
||||
LGraphNode,
|
||||
LiteGraph,
|
||||
isColorable
|
||||
} from '@comfyorg/litegraph'
|
||||
import { LGraphGroup, LGraphNode, isColorable } from '@comfyorg/litegraph'
|
||||
import type { IComboWidget } from '@comfyorg/litegraph/dist/types/widgets'
|
||||
import _ from 'lodash'
|
||||
|
||||
@@ -75,23 +70,3 @@ export function executeWidgetsCallback(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getImageTop(node: LGraphNode) {
|
||||
let shiftY: number
|
||||
if (node.imageOffset != null) {
|
||||
return node.imageOffset
|
||||
} else if (node.widgets?.length) {
|
||||
const w = node.widgets[node.widgets.length - 1]
|
||||
shiftY = w.last_y ?? 0
|
||||
if (w.computeSize) {
|
||||
shiftY += w.computeSize()[1] + 4
|
||||
} else if (w.computedHeight) {
|
||||
shiftY += w.computedHeight
|
||||
} else {
|
||||
shiftY += LiteGraph.NODE_WIDGET_HEIGHT + 4
|
||||
}
|
||||
} else {
|
||||
return node.computeSize()[1]
|
||||
}
|
||||
return shiftY
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user