mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-23 08:14:06 +00:00
Update litegraph (Getters) (#829)
* Update litegraph (Getters) * Update
This commit is contained in:
@@ -1396,7 +1396,7 @@ export class ComfyApp {
|
||||
return
|
||||
}
|
||||
|
||||
var groups = this.graph._groups
|
||||
var groups = this.graph.groups
|
||||
|
||||
ctx.save()
|
||||
ctx.globalAlpha = 0.7 * this.editor_alpha
|
||||
@@ -1632,8 +1632,7 @@ export class ComfyApp {
|
||||
|
||||
api.addEventListener('execution_start', ({ detail }) => {
|
||||
this.lastExecutionError = null
|
||||
// @ts-expect-error
|
||||
this.graph._nodes.forEach((node) => {
|
||||
this.graph.nodes.forEach((node) => {
|
||||
// @ts-expect-error
|
||||
if (node.onExecutionStart)
|
||||
// @ts-expect-error
|
||||
@@ -1690,8 +1689,7 @@ export class ComfyApp {
|
||||
// @ts-expect-error
|
||||
app.graph.onConfigure = function () {
|
||||
// Fire callbacks before the onConfigure, this is used by widget inputs to setup the config
|
||||
// @ts-expect-error
|
||||
for (const node of app.graph._nodes) {
|
||||
for (const node of app.graph.nodes) {
|
||||
// @ts-expect-error
|
||||
node.onGraphConfigured?.()
|
||||
}
|
||||
@@ -1699,8 +1697,7 @@ export class ComfyApp {
|
||||
const r = onConfigure?.apply(this, arguments)
|
||||
|
||||
// Fire after onConfigure, used by primitives to generate widget using input nodes config
|
||||
// @ts-expect-error _nodes is private.
|
||||
for (const node of app.graph._nodes) {
|
||||
for (const node of app.graph.nodes) {
|
||||
node.onAfterGraphConfigured?.()
|
||||
}
|
||||
|
||||
@@ -2334,8 +2331,7 @@ export class ComfyApp {
|
||||
|
||||
return
|
||||
}
|
||||
// @ts-expect-error
|
||||
for (const node of this.graph._nodes) {
|
||||
for (const node of this.graph.nodes) {
|
||||
const size = node.computeSize()
|
||||
size[0] = Math.max(node.size[0], size[0])
|
||||
size[1] = Math.max(node.size[1], size[1])
|
||||
@@ -2893,10 +2889,8 @@ export class ComfyApp {
|
||||
for (const nodeId in defs) {
|
||||
this.registerNodeDef(nodeId, defs[nodeId])
|
||||
}
|
||||
// @ts-expect-error
|
||||
for (let nodeNum in this.graph._nodes) {
|
||||
// @ts-expect-error
|
||||
const node = this.graph._nodes[nodeNum]
|
||||
for (let nodeNum in this.graph.nodes) {
|
||||
const node = this.graph.nodes[nodeNum]
|
||||
const def = defs[node.type]
|
||||
// @ts-expect-error
|
||||
// Allow primitive nodes to handle refresh
|
||||
|
||||
@@ -224,8 +224,8 @@ const computeVisibleNodes = LGraphCanvas.prototype.computeVisibleNodes
|
||||
//@ts-ignore
|
||||
LGraphCanvas.prototype.computeVisibleNodes = function (): LGraphNode[] {
|
||||
const visibleNodes = computeVisibleNodes.apply(this, arguments)
|
||||
// @ts-expect-error
|
||||
for (const node of app.graph._nodes) {
|
||||
|
||||
for (const node of app.graph.nodes) {
|
||||
if (elementWidgets.has(node)) {
|
||||
const hidden = visibleNodes.indexOf(node) === -1
|
||||
for (const w of node.widgets) {
|
||||
@@ -354,8 +354,7 @@ LGraphNode.prototype.addDOMWidget = function (
|
||||
width: `${widgetWidth - margin * 2}px`,
|
||||
height: `${(widget.computedHeight ?? 50) - margin * 2}px`,
|
||||
position: 'absolute',
|
||||
// @ts-expect-error
|
||||
zIndex: app.graph._nodes.indexOf(node)
|
||||
zIndex: app.graph.nodes.indexOf(node)
|
||||
})
|
||||
|
||||
if (enableDomClipping) {
|
||||
|
||||
@@ -56,14 +56,12 @@ export function applyTextReplacements(app: ComfyApp, value: string): string {
|
||||
}
|
||||
|
||||
// Find node with matching S&R property name
|
||||
// @ts-expect-error
|
||||
let nodes = app.graph._nodes.filter(
|
||||
let nodes = app.graph.nodes.filter(
|
||||
(n) => n.properties?.['Node name for S&R'] === split[0]
|
||||
)
|
||||
// If we cant, see if there is a node with that title
|
||||
if (!nodes.length) {
|
||||
// @ts-expect-error
|
||||
nodes = app.graph._nodes.filter((n) => n.title === split[0])
|
||||
nodes = app.graph.nodes.filter((n) => n.title === split[0])
|
||||
}
|
||||
if (!nodes.length) {
|
||||
console.warn('Unable to find node', split[0])
|
||||
|
||||
@@ -361,7 +361,7 @@ export function initWidgets(app) {
|
||||
options: ['before', 'after'],
|
||||
onChange(value) {
|
||||
controlValueRunBefore = value === 'before'
|
||||
for (const n of app.graph._nodes) {
|
||||
for (const n of app.graph.nodes) {
|
||||
if (!n.widgets) continue
|
||||
for (const w of n.widgets) {
|
||||
if (w[IS_CONTROL_WIDGET]) {
|
||||
|
||||
Reference in New Issue
Block a user