Revert "Add support for LiteGraph to convert to classes (#334)" (#386)

This reverts commit e2141a81e2.
This commit is contained in:
Chenlei Hu
2024-08-12 09:19:10 -04:00
committed by GitHub
parent d9df0328c5
commit d607f6c7f7
7 changed files with 37 additions and 49 deletions

View File

@@ -1,32 +1,32 @@
import { LiteGraph, LGraphCanvas } from '@comfyorg/litegraph'
import { app } from '../../scripts/app'
import { ComfyWidgets } from '../../scripts/widgets'
import { LGraphNode } from '@comfyorg/litegraph'
// Node that add notes to your project
app.registerExtension({
name: 'Comfy.NoteNode',
registerCustomNodes() {
class NoteNode extends LGraphNode {
class NoteNode {
static category: string
color = LGraphCanvas.node_colors.yellow.color
bgcolor = LGraphCanvas.node_colors.yellow.bgcolor
groupcolor = LGraphCanvas.node_colors.yellow.groupcolor
properties: { text: string }
serialize_widgets: boolean
isVirtualNode: boolean
collapsable: boolean
title_mode: number
constructor(title?: string) {
super(title)
constructor() {
if (!this.properties) {
this.properties = { text: '' }
}
ComfyWidgets.STRING(
// Should we extends LGraphNode? Yesss
// @ts-expect-error
// Should we extends LGraphNode?
this,
'',
// @ts-expect-error
['', { default: this.properties.text, multiline: true }],
app
)
@@ -40,6 +40,7 @@ app.registerExtension({
LiteGraph.registerNodeType(
'Note',
// @ts-expect-error
Object.assign(NoteNode, {
title_mode: LiteGraph.NORMAL_TITLE,
title: 'Note',