mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-23 15:59:47 +00:00
Fix ComfyExtension types (#778)
This commit is contained in:
@@ -170,6 +170,7 @@ export class ClipspaceDialog extends ComfyDialog {
|
||||
app.registerExtension({
|
||||
name: 'Comfy.Clipspace',
|
||||
init(app) {
|
||||
// @ts-expect-error Move to ComfyApp
|
||||
app.openClipspace = function () {
|
||||
if (!ClipspaceDialog.instance) {
|
||||
ClipspaceDialog.instance = new ClipspaceDialog()
|
||||
|
||||
@@ -74,6 +74,7 @@ app.registerExtension({
|
||||
const link = app.graph.links[linkId]
|
||||
if (!link) return
|
||||
const node = app.graph.getNodeById(link.origin_id)
|
||||
// @ts-expect-error Nodes that extend LGraphNode will not have a static type property
|
||||
const type = node.constructor.type
|
||||
if (type === 'Reroute') {
|
||||
if (node === this) {
|
||||
@@ -112,6 +113,7 @@ app.registerExtension({
|
||||
if (!link) continue
|
||||
|
||||
const node = app.graph.getNodeById(link.target_id)
|
||||
// @ts-expect-error Nodes that extend LGraphNode will not have a static type property
|
||||
const type = node.constructor.type
|
||||
|
||||
if (type === 'Reroute') {
|
||||
@@ -164,6 +166,7 @@ app.registerExtension({
|
||||
for (const l of node.outputs[0].links || []) {
|
||||
const link = app.graph.links[l]
|
||||
if (link) {
|
||||
// @ts-expect-error Fix litegraph types
|
||||
link.color = color
|
||||
|
||||
if (app.configuringGraph) continue
|
||||
@@ -177,6 +180,7 @@ app.registerExtension({
|
||||
}
|
||||
if (!targetWidget) {
|
||||
targetWidget = targetNode.widgets?.find(
|
||||
// @ts-expect-error fix widget types
|
||||
(w) => w.name === targetInput.widget.name
|
||||
)
|
||||
}
|
||||
@@ -209,6 +213,7 @@ app.registerExtension({
|
||||
if (inputNode) {
|
||||
const link = app.graph.links[inputNode.inputs[0].link]
|
||||
if (link) {
|
||||
// @ts-expect-error Fix litegraph types
|
||||
link.color = color
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,7 @@ app.registerExtension({
|
||||
slot_types_default_in: {},
|
||||
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
||||
var nodeId = nodeData.name
|
||||
var inputs = []
|
||||
inputs = nodeData['input']['required'] //only show required inputs to reduce the mess also not logical to create node with optional inputs
|
||||
const inputs = nodeData['input']['required'] //only show required inputs to reduce the mess also not logical to create node with optional inputs
|
||||
for (const inputKey in inputs) {
|
||||
var input = inputs[inputKey]
|
||||
if (typeof input[0] !== 'string') continue
|
||||
|
||||
@@ -826,6 +826,7 @@ app.registerExtension({
|
||||
}
|
||||
|
||||
function isNodeAtPos(pos) {
|
||||
// @ts-expect-error Fix litegraph types
|
||||
for (const n of app.graph._nodes) {
|
||||
if (n.pos[0] === pos[0] && n.pos[1] === pos[1]) {
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user