@gausszhou/litegraph-core / LGraphNode
Class: LGraphNode
Defined in: packages/core/src/LGraphNode.ts:111
https://github.com/jagenjo/litegraph.js/blob/master/guides/README.md#lgraphnode
Extended by
Constructors
Constructor
new LGraphNode(): LGraphNode;Defined in: packages/core/src/LGraphNode.ts:124
Returns
LGraphNode
Properties
_collapsed_width?
_collapsed_width?: number;Defined in: packages/core/src/LGraphNode.ts:222
_level
_level: number;Defined in: packages/core/src/LGraphNode.ts:204
_relative_id
_relative_id: string | number | null = null;Defined in: packages/core/src/LGraphNode.ts:203
action_call
action_call: string | null = null;Defined in: packages/core/src/LGraphNode.ts:224
action_triggered
action_triggered: number = 0;Defined in: packages/core/src/LGraphNode.ts:228
the nFrames it will be used (-- each step), means "how old" is the event
bgcolor
bgcolor: string;Defined in: packages/core/src/LGraphNode.ts:192
block_delete
block_delete: boolean = false;Defined in: packages/core/src/LGraphNode.ts:198
boxcolor
boxcolor: string;Defined in: packages/core/src/LGraphNode.ts:193
category
category: string | null;Defined in: packages/core/src/LGraphNode.ts:152
class
class: new () => LGraphNode;Defined in: packages/core/src/LGraphNode.ts:169
Returns
LGraphNode
clip_area
clip_area: boolean;Defined in: packages/core/src/LGraphNode.ts:214
if you render outside the node, it will be clipped
clonable
clonable: boolean = true;Defined in: packages/core/src/LGraphNode.ts:166
collapsable
collapsable: boolean = true;Defined in: packages/core/src/LGraphNode.ts:167
color
color: string;Defined in: packages/core/src/LGraphNode.ts:191
connections
connections: INodeConnection[];Defined in: packages/core/src/LGraphNode.ts:179
desc
desc: string = "";Defined in: packages/core/src/LGraphNode.ts:150
exec_version
exec_version: number = 0;Defined in: packages/core/src/LGraphNode.ts:223
execute_triggered
execute_triggered: number = 0;Defined in: packages/core/src/LGraphNode.ts:226
the nFrames it will be used (-- each step), means "how old" is the event
flags
flags: Partial<{
collapsed: boolean;
pinned: boolean;
skip_repeated_outputs: boolean;
}>;Defined in: packages/core/src/LGraphNode.ts:185
graph
graph: LGraph | null;Defined in: packages/core/src/LGraphNode.ts:155
graph_version
graph_version: number;Defined in: packages/core/src/LGraphNode.ts:156
has_errors?
has_errors?: boolean;Defined in: packages/core/src/LGraphNode.ts:220
if true, the node will show the bgcolor as 'red'
hide_in_node_lists
hide_in_node_lists: boolean = false;Defined in: packages/core/src/LGraphNode.ts:197
horizontal
horizontal: boolean;Defined in: packages/core/src/LGraphNode.ts:218
slots are distributed horizontally
id
id: NodeID;Defined in: packages/core/src/LGraphNode.ts:171
ignore_remove
ignore_remove: boolean = false;Defined in: packages/core/src/LGraphNode.ts:199
inputs
inputs: INodeInputSlot[];Defined in: packages/core/src/LGraphNode.ts:177
is_selected
is_selected: boolean;Defined in: packages/core/src/LGraphNode.ts:159
last_serialization?
last_serialization?:
| SerializedLGraphNode<LGraphNode>
| null = null;Defined in: packages/core/src/LGraphNode.ts:201
mode?
mode?: NodeMode;Defined in: packages/core/src/LGraphNode.ts:207
Used in LGraphCanvas.onMenuNodeMode
mouseOver
mouseOver: boolean;Defined in: packages/core/src/LGraphNode.ts:160
order
order: number;Defined in: packages/core/src/LGraphNode.ts:163
outputs
outputs: INodeOutputSlot[];Defined in: packages/core/src/LGraphNode.ts:178
pos
pos: Vector2;Defined in: packages/core/src/LGraphNode.ts:154
priority
priority: number = 0;Defined in: packages/core/src/LGraphNode.ts:162
computeExecutionOrder sorts by priority first, then order if priorities are the same
properties
properties: Record<string, any>;Defined in: packages/core/src/LGraphNode.ts:182
properties_info
properties_info: IProperty[];Defined in: packages/core/src/LGraphNode.ts:183
redraw_on_mouse
redraw_on_mouse: boolean;Defined in: packages/core/src/LGraphNode.ts:164
removable
removable: boolean = true;Defined in: packages/core/src/LGraphNode.ts:165
resizable
resizable: boolean;Defined in: packages/core/src/LGraphNode.ts:216
if set to false it wont be resizable with the mouse
serialize_widgets
serialize_widgets: boolean = false;Defined in: packages/core/src/LGraphNode.ts:196
shape
shape: number;Defined in: packages/core/src/LGraphNode.ts:194
size
size: Vector2;Defined in: packages/core/src/LGraphNode.ts:153
skip_subgraph_button
skip_subgraph_button: boolean = false;Defined in: packages/core/src/LGraphNode.ts:158
subgraph
subgraph: LGraph | null = null;Defined in: packages/core/src/LGraphNode.ts:157
title
title: string;Defined in: packages/core/src/LGraphNode.ts:149
titleMode
titleMode: TitleMode = TitleMode.NORMAL_TITLE;Defined in: packages/core/src/LGraphNode.ts:168
type
type: string | null;Defined in: packages/core/src/LGraphNode.ts:151
widgets
widgets:
| IWidget<any, any>[]
| null
| undefined;Defined in: packages/core/src/LGraphNode.ts:173
widgets_start_y
widgets_start_y: number;Defined in: packages/core/src/LGraphNode.ts:212
widgets start at y distance from the top of the node
widgets_up
widgets_up: boolean;Defined in: packages/core/src/LGraphNode.ts:210
If set to true widgets do not start after the slots
widgets_values?
widgets_values?: any[];Defined in: packages/core/src/LGraphNode.ts:174
MAX_CONSOLE
static MAX_CONSOLE: number = 100;Defined in: packages/core/src/LGraphNode.ts:2787
title
static title: string;Defined in: packages/core/src/LGraphNode.ts:120
title_color
static title_color: string;Defined in: packages/core/src/LGraphNode.ts:119
type
static type: string | null;Defined in: packages/core/src/LGraphNode.ts:121
widgets_up
static widgets_up: boolean;Defined in: packages/core/src/LGraphNode.ts:122
Accessors
slotLayout
Get Signature
get slotLayout(): SlotLayout | null;Defined in: packages/core/src/LGraphNode.ts:112
Returns
SlotLayout | null
Methods
actionDo()
actionDo(
action,
param,
options?
): void;Defined in: packages/core/src/LGraphNode.ts:1145
Triggers an action, wrapped by logics to control execution flow
Parameters
action
any
name
param
any
options?
LActionOptions = {}
Returns
void
Method
actionDo
addConnection()
addConnection(
name,
type,
pos,
direction
): INodeConnection;Defined in: packages/core/src/LGraphNode.ts:1555
add an special connection to this node (used for special kinds of graphs)
Parameters
name
string
type
string
string defining the input type ("vec3","number",...)
pos
position of the connection inside the node
direction
string
if is input or output
Returns
addCustomWidget()
addCustomWidget<T>(customWidget): T;Defined in: packages/core/src/LGraphNode.ts:1762
Type Parameters
T
T extends IWidget<any, any>
Parameters
customWidget
T
Returns
T
addInput()
addInput(
name,
type?,
extra_info?
): INodeInputSlot;Defined in: packages/core/src/LGraphNode.ts:1459
add a new input slot to use in this node
Parameters
name
string
type?
SlotType = BuiltInSlotType.DEFAULT
string defining the input type ("vec3","number",...), it its a generic one use 0
extra_info?
Partial<INodeInputSlot>
this can be used to have special properties of an input (label, color, position, etc)
Returns
addOnExecutedOutput()
addOnExecutedOutput(): number;Defined in: packages/core/src/LGraphNode.ts:1065
Returns
number
addOnTriggerInput()
addOnTriggerInput(): number;Defined in: packages/core/src/LGraphNode.ts:1056
Returns
number
addOutput()
addOutput(
name,
type?,
extra_info?
): INodeOutputSlot;Defined in: packages/core/src/LGraphNode.ts:1351
add a new output slot to use in this node
Parameters
name
string
type?
SlotType = BuiltInSlotType.DEFAULT
string defining the output type ("vec3","number",...)
extra_info?
Partial<INodeOutputSlot>
this can be used to have special properties of an output (label, special color, position, etc)
Returns
addProperty()
addProperty(
name,
default_value,
type?,
extra_info?
): IProperty;Defined in: packages/core/src/LGraphNode.ts:1322
add a new property to this node
Parameters
name
string
default_value
any
type?
string
string defining the output type ("vec3","number",...)
extra_info?
Partial<IPropertyInfo>
this can be used to have special properties of the property (like values, etc)
Returns
addWidget()
addWidget<T>(
type,
name,
value,
callback?,
options?
): T;Defined in: packages/core/src/LGraphNode.ts:1707
https://github.com/jagenjo/litegraph.js/blob/master/guides/README.md#node-widgets
Type Parameters
T
T extends IWidget<any, any>
Parameters
type
T["type"]
name
string
value
T["value"]
callback?
string | WidgetCallback<T>
options?
T["options"]
Returns
T
created widget
alignToGrid()
alignToGrid(): void;Defined in: packages/core/src/LGraphNode.ts:2776
Force align to grid
Returns
void
captureInput()
captureInput(v): void;Defined in: packages/core/src/LGraphNode.ts:2824
Allows to get onMouseMove and onMouseUp events even if the mouse is out of focus
Parameters
v
any
Returns
void
changeMode()
changeMode(modeTo): boolean;Defined in: packages/core/src/LGraphNode.ts:1086
Parameters
modeTo
Returns
boolean
clearTriggeredSlot()
clearTriggeredSlot(slot, link_id?): void;Defined in: packages/core/src/LGraphNode.ts:1273
clears the trigger slot animation
Parameters
slot
number
the index of the output slot
link_id?
in case you want to trigger and specific output link in a slot
Returns
void
clone()
clone(cloneData?): LGraphNode;Defined in: packages/core/src/LGraphNode.ts:408
Creates a clone of this node
Parameters
cloneData?
LGraphNodeCloneData = ...
Returns
LGraphNode
collapse()
collapse(force?): void;Defined in: packages/core/src/LGraphNode.ts:2853
Collapse the node to make it smaller on the canvas
Parameters
force?
boolean = false
Returns
void
computeSize()
computeSize(out?): Vector2;Defined in: packages/core/src/LGraphNode.ts:1573
computes the size of a node according to its inputs and output slots
Parameters
out?
Vector2 = ...
Returns
configure()
configure(info): void;Defined in: packages/core/src/LGraphNode.ts:237
configure a node from an object containing the serialized info
Parameters
info
Returns
void
connect()
connect<T>(
slot,
targetNode,
targetSlot
): T | null;Defined in: packages/core/src/LGraphNode.ts:2196
connect this node output to the input of another node
Type Parameters
T
T = any
Parameters
slot
string | number
(could be the number of the slot or the string with the name of the slot)
targetNode
LGraphNode
the target node
targetSlot
string | number
the input slot of the target node (could be the number of the slot or the string with the name of the slot, or -1 to connect a trigger)
Returns
T | null
the linkInfo is created, otherwise null
connectByTypeInput()
connectByTypeInput(
slot,
targetNode,
targetSlotType,
optsIn?
): any;Defined in: packages/core/src/LGraphNode.ts:2061
connect this node output to the input of another node BY TYPE
Parameters
slot
(could be the number of the slot or the string with the name of the slot)
targetNode
LGraphNode
targetSlotType
optsIn?
createEventInCase?
boolean
firstFreeIfOutputGeneralInCase?
boolean
generalTypeInCase?
boolean
Returns
any
the link_info is created, otherwise null
Method
connectByType
connectByTypeOutput()
connectByTypeOutput(
slot,
sourceNode,
sourceSlotType,
optsIn?
): any;Defined in: packages/core/src/LGraphNode.ts:2131
connect this node input to the output of another node BY TYPE
Parameters
slot
(could be the number of the slot or the string with the name of the slot)
sourceNode
LGraphNode
sourceSlotType
optsIn?
createEventInCase?
boolean
firstFreeIfOutputGeneralInCase?
boolean
generalTypeInCase?
boolean
Returns
any
the link_info is created, otherwise null
Method
connectByType
disconnectInput()
disconnectInput(slot, options?): boolean;Defined in: packages/core/src/LGraphNode.ts:2597
disconnect one input
Parameters
slot
(could be the number of the slot or the string with the name of the slot)
options?
doProcessChange?
boolean
Returns
boolean
if it was disconnected successfully
disconnectOutput()
disconnectOutput(
slot,
targetNode?,
options?
): boolean;Defined in: packages/core/src/LGraphNode.ts:2430
disconnect one output to an specific node
Parameters
slot
(could be the number of the slot or the string with the name of the slot)
targetNode?
LGraphNode
the target node to which this slot is connected [Optional, if not targetNode is specified all nodes will be disconnected]
options?
object
Returns
boolean
if it was disconnected successfully
doExecute()
doExecute(param?, options?): void;Defined in: packages/core/src/LGraphNode.ts:1113
Parameters
param?
any
options?
LActionOptions = {}
Returns
void
findInputSlotByName()
findInputSlotByName(
name?,
onlyFree?,
typesNotAccepted?
): INodeInputSlot | null;Defined in: packages/core/src/LGraphNode.ts:1906
Parameters
name?
string
onlyFree?
boolean = false
typesNotAccepted?
SlotType[]
Returns
INodeInputSlot | null
findInputSlotByType()
findInputSlotByType(
type,
preferFreeSlot?,
doNotUseOccupied?
): INodeInputSlot | null;Defined in: packages/core/src/LGraphNode.ts:1982
findSlotByType for INPUTS
Parameters
type
preferFreeSlot?
boolean = false
doNotUseOccupied?
boolean = false
Returns
INodeInputSlot | null
findInputSlotIndexByName()
findInputSlotIndexByName(
name?,
onlyFree?,
typesNotAccepted?
): number;Defined in: packages/core/src/LGraphNode.ts:1888
returns the input slot with a given name (used for dynamic slots), -1 if not found
Parameters
name?
string
the name of the slot
onlyFree?
boolean = false
typesNotAccepted?
SlotType[]
Returns
number
the slot (-1 if not found)
findInputSlotIndexByType()
findInputSlotIndexByType(
type,
preferFreeSlot?,
doNotUseOccupied?
): number;Defined in: packages/core/src/LGraphNode.ts:1968
findSlotByType for INPUTS
Parameters
type
preferFreeSlot?
boolean = false
doNotUseOccupied?
boolean = false
Returns
number
findOutputSlotByName()
findOutputSlotByName(
name?,
onlyFree?,
typesNotAccepted?
): INodeOutputSlot | null;Defined in: packages/core/src/LGraphNode.ts:1947
Parameters
name?
string
onlyFree?
boolean = false
typesNotAccepted?
SlotType[]
Returns
INodeOutputSlot | null
findOutputSlotByType()
findOutputSlotByType(
type,
preferFreeSlot?,
doNotUseOccupied?
): INodeOutputSlot | null;Defined in: packages/core/src/LGraphNode.ts:1989
findSlotByType for OUTPUTS
Parameters
type
preferFreeSlot?
boolean = false
doNotUseOccupied?
boolean = false
Returns
INodeOutputSlot | null
findOutputSlotIndexByName()
findOutputSlotIndexByName(
name?,
onlyFree?,
typesNotAccepted?
): number;Defined in: packages/core/src/LGraphNode.ts:1929
returns the output slot with a given name (used for dynamic slots), -1 if not found
Parameters
name?
string
the name of the slot
onlyFree?
boolean = false
typesNotAccepted?
SlotType[]
Returns
number
the slot (-1 if not found)
findOutputSlotIndexByType()
findOutputSlotIndexByType(
type,
preferFreeSlot?,
doNotUseOccupied?
): number;Defined in: packages/core/src/LGraphNode.ts:1975
findSlotByType for OUTPUTS
Parameters
type
preferFreeSlot?
boolean = false
doNotUseOccupied?
boolean = false
Returns
number
getBounding()
getBounding(out?): Float32Array;Defined in: packages/core/src/LGraphNode.ts:1780
returns the bounding of the object, used for rendering purposes
Parameters
out?
Float32Array<ArrayBufferLike>
Returns
Float32Array
[x, y, width, height]
getConnectionPos()
getConnectionPos(
is_input,
slotNumber,
out?,
ignore_collapsed?
): Vector2;Defined in: packages/core/src/LGraphNode.ts:2693
returns the center of a connection point in canvas coords
Parameters
is_input
boolean
true if if a input slot, false if it is an output
slotNumber
number
out?
Vector2 = ...
a place to store the output, to free garbage
ignore_collapsed?
boolean = false
Returns
the position
getExtraLinkOptions()?
getExtraLinkOptions?(
graphCanvas,
link,
linkType,
options
): ContextMenuItem[];Defined in: packages/core/src/LGraphNode.ts:3126
Parameters
graphCanvas
link
linkType
options
Returns
getExtraMenuOptions()?
getExtraMenuOptions?(graphCanvas, options): ContextMenuItem[];Defined in: packages/core/src/LGraphNode.ts:3125
Parameters
graphCanvas
options
Returns
getInputData()
getInputData<T>(slot, force_update?): T;Defined in: packages/core/src/LGraphNode.ts:688
Retrieves the input data (data traveling through the connection) from one slot
Type Parameters
T
T = any
Parameters
slot
number
force_update?
boolean
if set to true it will force the connected node of this slot to output data into this link
Returns
T
data or if it is not connected returns undefined
getInputDataByName()
getInputDataByName<T>(slot_name, force_update?): T;Defined in: packages/core/src/LGraphNode.ts:763
Retrieves the input data from one slot using its name instead of slot number
Type Parameters
T
T = any
Parameters
slot_name
string
force_update?
boolean
if set to true it will force the connected node of this slot to output data into this link
Returns
T
data or if it is not connected returns null
getInputDataType()
getInputDataType(slot): SlotType | null;Defined in: packages/core/src/LGraphNode.ts:730
Retrieves the input data type (in case this supports multiple input types)
Parameters
slot
number
Returns
SlotType | null
datatype in string format
getInputInfo()
getInputInfo(slot): INodeInputSlot | null;Defined in: packages/core/src/LGraphNode.ts:780
tells you info about an input connection (which node, type, etc)
Parameters
slot
number
Returns
INodeInputSlot | null
getInputLink()
getInputLink(slot): LLink | null;Defined in: packages/core/src/LGraphNode.ts:795
Returns the link info in the connection of an input slot
Parameters
slot
number
Returns
LLink | null
object or null
getInputNode()
getInputNode(slot): LGraphNode | null;Defined in: packages/core/src/LGraphNode.ts:810
returns the node connected in the input slot
Parameters
slot
number
Returns
LGraphNode | null
getInputOrProperty()
getInputOrProperty<T>(name): T;Defined in: packages/core/src/LGraphNode.ts:835
returns the value of an input with this name, otherwise checks if there is a property with that name
Type Parameters
T
T = any
Parameters
name
string
Returns
T
getInputSlotProperty()
getInputSlotProperty(slot, name): any;Defined in: packages/core/src/LGraphNode.ts:503
Parameters
slot
number
name
string
Returns
any
getInputSlotsConnectedTo()
getInputSlotsConnectedTo(slot): INodeInputSlot[];Defined in: packages/core/src/LGraphNode.ts:948
Returns the input slots in other nodes that an output in this node is connected to.
Parameters
slot
number
Returns
object or null
getMenuOptions()?
getMenuOptions?(graphCanvas): ContextMenuItem[];Defined in: packages/core/src/LGraphNode.ts:3124
Called by LGraphCanvas.processContextMenu
Parameters
graphCanvas
Returns
getOptionalSlots()
getOptionalSlots(): OptionalSlots | null;Defined in: packages/core/src/LGraphNode.ts:3115
Returns
OptionalSlots | null
getOutputData()
getOutputData<T>(slot): T | null;Defined in: packages/core/src/LGraphNode.ts:910
tells you the last output data that went in that slot
Type Parameters
T
T = any
Parameters
slot
number
Returns
T | null
getOutputInfo()
getOutputInfo(slot): INodeOutputSlot | null;Defined in: packages/core/src/LGraphNode.ts:970
tells you info about an output connection (which node, type, etc)
Parameters
slot
number
Returns
INodeOutputSlot | null
getOutputLinks()
getOutputLinks(slot): LLink[];Defined in: packages/core/src/LGraphNode.ts:927
Returns the link info in the connection of an output slot
Parameters
slot
number
Returns
LLink[]
object or null
getOutputNodes()
getOutputNodes(slot): LGraphNode[];Defined in: packages/core/src/LGraphNode.ts:1006
retrieves all the nodes connected to this output slot
Parameters
slot
number
Returns
LGraphNode[]
getOutputSlotConnectedTo()
getOutputSlotConnectedTo(slot): INodeOutputSlot | null;Defined in: packages/core/src/LGraphNode.ts:886
Returns the output slot in another node that an input in this node is connected to.
Parameters
slot
number
Returns
INodeOutputSlot | null
object or null
getOutputSlotProperty()
getOutputSlotProperty(slot, name): any;Defined in: packages/core/src/LGraphNode.ts:521
Parameters
slot
number
name
string
Returns
any
getPropertyInfo()
getPropertyInfo(property): IPropertyInfo;Defined in: packages/core/src/LGraphNode.ts:1668
returns all the info available about a property of this node.
Parameters
property
string
name of the property
Returns
the object with all the available info
Method
getPropertyInfo
getRootGraph()
getRootGraph(): LGraph | null;Defined in: packages/core/src/LGraphNode.ts:455
Returns
LGraph | null
getSlotInPosition()
getSlotInPosition(x, y): SlotInPosition | null;Defined in: packages/core/src/LGraphNode.ts:1831
checks if a point is inside a node slot, and returns info about which slot
Parameters
x
number
y
number
Returns
SlotInPosition | null
getSlotMenuOptions()?
getSlotMenuOptions?(slot): ContextMenuItem[];Defined in: packages/core/src/LGraphNode.ts:3127
Parameters
slot
Returns
getTitle()
getTitle(): string;Defined in: packages/core/src/LGraphNode.ts:451
get the title string
Returns
string
is()
is<T>(ctor): this is T;Defined in: packages/core/src/LGraphNode.ts:1878
Type Parameters
T
T extends LGraphNode
Parameters
ctor
new () => T
Returns
this is T
isAnyOutputConnected()
isAnyOutputConnected(): boolean;Defined in: packages/core/src/LGraphNode.ts:993
tells you if there is any connection in the output slots
Returns
boolean
isInputConnected()
isInputConnected(slot): boolean;Defined in: packages/core/src/LGraphNode.ts:772
tells you if there is a connection in one input slot
Parameters
slot
number
Returns
boolean
isOutputConnected()
isOutputConnected(slot): boolean;Defined in: packages/core/src/LGraphNode.ts:981
tells you if there is a connection in one output slot
Parameters
slot
number
Returns
boolean
isPointInside()
isPointInside(
x,
y,
margin?,
skipTitle?
): boolean;Defined in: packages/core/src/LGraphNode.ts:1794
checks if a point is inside the shape of a node
Parameters
x
number
y
number
margin?
number = 0
skipTitle?
boolean = false
Returns
boolean
isShowingTitle()
isShowingTitle(mouseOver): boolean;Defined in: packages/core/src/LGraphNode.ts:2843
Parameters
mouseOver
boolean
Returns
boolean
iterateAllLinks()
iterateAllLinks(): Iterable<LLink>;Defined in: packages/core/src/LGraphNode.ts:1034
Returns
Iterable<LLink>
iterateInputInfo()
iterateInputInfo(): Iterable<INodeInputSlot>;Defined in: packages/core/src/LGraphNode.ts:677
Returns
Iterable<INodeInputSlot>
iterateOutputInfo()
iterateOutputInfo(): Iterable<INodeOutputSlot>;Defined in: packages/core/src/LGraphNode.ts:904
Returns
Iterable<INodeOutputSlot>
iterateParentSubgraphNodes()
iterateParentSubgraphNodes(): Iterable<Subgraph>;Defined in: packages/core/src/LGraphNode.ts:467
Returns
Iterable<Subgraph>
loadImage()
loadImage(url): HTMLImageElement;Defined in: packages/core/src/LGraphNode.ts:2812
Parameters
url
string
Returns
HTMLImageElement
localToScreen()
localToScreen(
x,
y,
graphCanvas
): Vector2;Defined in: packages/core/src/LGraphNode.ts:2876
Parameters
x
number
y
number
graphCanvas
Returns
moveInput()
moveInput(slot, newSlot): void;Defined in: packages/core/src/LGraphNode.ts:1520
Parameters
slot
number
newSlot
number
Returns
void
moveOutput()
moveOutput(slot, newSlot): void;Defined in: packages/core/src/LGraphNode.ts:1421
Parameters
slot
number
newSlot
number
Returns
void
onAction()?
onAction?(
action,
param,
options
): void;Defined in: packages/core/src/LGraphNode.ts:2991
Parameters
action
any
param
any
options
Returns
void
onAdded()?
onAdded?(graph): void;Defined in: packages/core/src/LGraphNode.ts:3003
when added to graph (warning: this is called BEFORE the node is configured when loading) Called by LGraph.add
Parameters
graph
Returns
void
onAddPropertyToPanel()?
onAddPropertyToPanel?(name, panel): boolean;Defined in: packages/core/src/LGraphNode.ts:3084
Parameters
name
string
panel
Returns
boolean
onAfterExecuteNode()
onAfterExecuteNode(param, options?): void;Defined in: packages/core/src/LGraphNode.ts:1074
Parameters
param
any
options?
object
Returns
void
onBeforeConnectInput()?
onBeforeConnectInput?(inputIndex): number;Defined in: packages/core/src/LGraphNode.ts:3053
Called just before connection (or disconnect - if input is linked). A convenient place to switch to another input, or create new one. This allow for ability to automatically add slots if needed
Parameters
inputIndex
number
Returns
number
selected input slot index, can differ from parameter value
onBounding()?
onBounding?(area): boolean;Defined in: packages/core/src/LGraphNode.ts:2935
Parameters
area
Float32Array
Returns
boolean
onConfigure()?
onConfigure?(o): void;Defined in: packages/core/src/LGraphNode.ts:2997
Called by LGraph.configure
Parameters
o
Returns
void
onConnectInput()?
onConnectInput?(
inputIndex,
outputType,
outputSlot,
outputNode,
outputIndex
): boolean;Defined in: packages/core/src/LGraphNode.ts:3020
if returns false the incoming connection will be canceled Called by LGraph.connect
Parameters
inputIndex
number
target input slot number
outputType
type of output slot
outputSlot
output slot object
outputNode
LGraphNode
node containing the output
outputIndex
number
index of output slot
Returns
boolean
onConnectionsChange()?
onConnectionsChange?(
type,
slotIndex,
isConnected,
link,
ioSlot
): void;Defined in: packages/core/src/LGraphNode.ts:3059
a connection changed (new one or removed) (LiteGraph.INPUT or LiteGraph.OUTPUT, slot, true if connected, linkInfo, input_info or output_info )
Parameters
type
slotIndex
number
isConnected
boolean
link
ioSlot
| INodeInputSlot | INodeOutputSlot
Returns
void
onConnectOutput()?
onConnectOutput?(
outputIndex,
inputType,
inputSlot,
inputNode,
inputIndex
): boolean;Defined in: packages/core/src/LGraphNode.ts:3037
if returns false the incoming connection will be canceled Called by LGraph.connect
Parameters
outputIndex
number
target output slot number
inputType
type of input slot
inputSlot
input slot object
inputNode
LGraphNode
node containing the input
inputIndex
number
index of input slot
Returns
boolean
onDblClick()?
onDblClick?(
event,
pos,
graphCanvas
): void;Defined in: packages/core/src/LGraphNode.ts:2969
Parameters
event
pos
graphCanvas
Returns
void
onDeselected()?
onDeselected?(): void;Defined in: packages/core/src/LGraphNode.ts:2986
Called by LGraphCanvas.deselectNode
Returns
void
onDrawBackground()?
onDrawBackground?(
ctx,
graphCanvas,
canvas,
pos
): void;Defined in: packages/core/src/LGraphNode.ts:2885
Parameters
ctx
CanvasRenderingContext2D
graphCanvas
canvas
HTMLCanvasElement
pos
Returns
void
onDrawCollapsed()?
onDrawCollapsed?(ctx, graphCanvas): boolean;Defined in: packages/core/src/LGraphNode.ts:2898
Parameters
ctx
CanvasRenderingContext2D
graphCanvas
Returns
boolean
onDrawForeground()?
onDrawForeground?(
ctx,
graphCanvas,
canvas
): void;Defined in: packages/core/src/LGraphNode.ts:2892
Parameters
ctx
CanvasRenderingContext2D
graphCanvas
canvas
HTMLCanvasElement
Returns
void
onDrawTitle()?
onDrawTitle?(ctx, graphCanvas): boolean;Defined in: packages/core/src/LGraphNode.ts:2930
Parameters
ctx
CanvasRenderingContext2D
graphCanvas
Returns
boolean
onDrawTitleBar()?
onDrawTitleBar?(
ctx,
graphCanvas,
title_height,
size,
scale,
fgColor
): boolean;Defined in: packages/core/src/LGraphNode.ts:2903
Parameters
ctx
CanvasRenderingContext2D
graphCanvas
title_height
number
size
scale
number
fgColor
string
Returns
boolean
onDrawTitleBox()?
onDrawTitleBox?(
ctx,
graphCanvas,
title_height,
size,
scale
): boolean;Defined in: packages/core/src/LGraphNode.ts:2912
Parameters
ctx
CanvasRenderingContext2D
graphCanvas
title_height
number
size
scale
number
Returns
boolean
onDrawTitleText()?
onDrawTitleText?(
ctx,
graphCanvas,
title_height,
size,
scale,
font,
selected
): boolean;Defined in: packages/core/src/LGraphNode.ts:2920
Parameters
ctx
CanvasRenderingContext2D
graphCanvas
title_height
number
size
scale
number
font
string
selected
boolean
Returns
boolean
onDropData()?
onDropData?(
data,
filename,
file
): void;Defined in: packages/core/src/LGraphNode.ts:233
Parameters
data
string | ArrayBuffer
filename
string
file
File
Returns
void
onDropFile()?
onDropFile?(file): void;Defined in: packages/core/src/LGraphNode.ts:232
Parameters
file
File
Returns
void
onDropItem()?
onDropItem?(e): boolean | void;Defined in: packages/core/src/LGraphNode.ts:234
Parameters
e
DragEvent
Returns
boolean | void
onExecute()?
onExecute?(param, options): void;Defined in: packages/core/src/LGraphNode.ts:2989
Called by LGraph.runStep LGraphNode.getInputData
Parameters
param
any
options
object
Returns
void
onGetPropertyInfo()?
onGetPropertyInfo?(property): IPropertyInfo;Defined in: packages/core/src/LGraphNode.ts:3082
Parameters
property
string
Returns
onInputAdded()?
onInputAdded?(input): void;Defined in: packages/core/src/LGraphNode.ts:3093
Parameters
input
Returns
void
onInputClick()?
onInputClick?(slot, event): void;Defined in: packages/core/src/LGraphNode.ts:3097
Parameters
slot
number
event
Returns
void
onInputDblClick()?
onInputDblClick?(slot, event): void;Defined in: packages/core/src/LGraphNode.ts:3099
Parameters
slot
number
event
Returns
void
onInputRemoved()?
onInputRemoved?(slot, input): void;Defined in: packages/core/src/LGraphNode.ts:3095
Parameters
slot
number
input
Returns
void
onJSPropertyChanged()?
onJSPropertyChanged?(
property,
value,
prevValue?
): boolean | void;Defined in: packages/core/src/LGraphNode.ts:3080
Called when the node's title or other JS property changes
Parameters
property
string
value
any
prevValue?
any
Returns
boolean | void
onKey()?
onKey?(
event,
pos,
graphCanvas
): void;Defined in: packages/core/src/LGraphNode.ts:2975
Parameters
event
KeyboardEvent
pos
graphCanvas
Returns
void
onKeyDown()?
onKeyDown?(event): void;Defined in: packages/core/src/LGraphNode.ts:2976
Parameters
event
KeyboardEvent
Returns
void
onKeyUp()?
onKeyUp?(event): void;Defined in: packages/core/src/LGraphNode.ts:2977
Parameters
event
KeyboardEvent
Returns
void
onMenuNodeInputs()?
onMenuNodeInputs?(item): ContextMenuItem[];Defined in: packages/core/src/LGraphNode.ts:3089
Parameters
item
Returns
onMenuNodeOutputs()?
onMenuNodeOutputs?(item): ContextMenuItem[];Defined in: packages/core/src/LGraphNode.ts:3101
Parameters
item
Returns
onMouseDown()?
onMouseDown?(
event,
pos,
graphCanvas
): boolean | void;Defined in: packages/core/src/LGraphNode.ts:2939
Parameters
event
pos
graphCanvas
Returns
boolean | void
onMouseEnter()?
onMouseEnter?(
event,
pos,
graphCanvas
): void;Defined in: packages/core/src/LGraphNode.ts:2957
Parameters
event
pos
graphCanvas
Returns
void
onMouseLeave()?
onMouseLeave?(
event,
pos,
graphCanvas
): void;Defined in: packages/core/src/LGraphNode.ts:2963
Parameters
event
pos
graphCanvas
Returns
void
onMouseMove()?
onMouseMove?(
event,
pos,
graphCanvas
): void;Defined in: packages/core/src/LGraphNode.ts:2945
Parameters
event
pos
graphCanvas
Returns
void
onMouseUp()?
onMouseUp?(
event,
pos,
graphCanvas
): void;Defined in: packages/core/src/LGraphNode.ts:2951
Parameters
event
pos
graphCanvas
Returns
void
onNodeCreated()?
onNodeCreated?(): void;Defined in: packages/core/src/LGraphNode.ts:230
Returns
void
onNodeOptionalInputAdd()?
onNodeOptionalInputAdd?(value): void;Defined in: packages/core/src/LGraphNode.ts:3091
Parameters
value
any
Returns
void
onNodeOptionalOutputAdd()?
onNodeOptionalOutputAdd?(value): void;Defined in: packages/core/src/LGraphNode.ts:3103
Parameters
value
any
Returns
void
onOutputAdded()?
onOutputAdded?(output): void;Defined in: packages/core/src/LGraphNode.ts:3107
Parameters
output
Returns
void
onOutputClick()?
onOutputClick?(slot, event): void;Defined in: packages/core/src/LGraphNode.ts:3111
Parameters
slot
number
event
Returns
void
onOutputDblClick()?
onOutputDblClick?(slot, event): void;Defined in: packages/core/src/LGraphNode.ts:3113
Parameters
slot
number
event
Returns
void
onOutputRemoved()?
onOutputRemoved?(slot, output): void;Defined in: packages/core/src/LGraphNode.ts:3109
Parameters
slot
number
output
Returns
void
onPropertyChanged()?
onPropertyChanged?(
property,
value,
prevValue?
): boolean | void;Defined in: packages/core/src/LGraphNode.ts:3075
if returns false, will abort the LGraphNode.setProperty Called when a property is changed
Parameters
property
string
value
any
prevValue?
any
Returns
boolean | void
onReassignID()?
onReassignID?(idMap): void;Defined in: packages/core/src/LGraphNode.ts:3121
Parameters
idMap
Returns
void
onRemoved()?
onRemoved?(options?): void;Defined in: packages/core/src/LGraphNode.ts:3009
when removed from graph Called by LGraph.remove LGraph.clear
Parameters
options?
Returns
void
onResize()?
onResize?(size): void;Defined in: packages/core/src/LGraphNode.ts:2979
Parameters
size
Returns
void
onSelected()?
onSelected?(): void;Defined in: packages/core/src/LGraphNode.ts:2983
Called by LGraphCanvas.selectNodes
Returns
void
onSerialize()?
onSerialize?(o): void;Defined in: packages/core/src/LGraphNode.ts:2994
Called by LGraph.serialize
Parameters
o
Returns
void
onShowCustomPanelInfo()?
onShowCustomPanelInfo?(panel): void;Defined in: packages/core/src/LGraphNode.ts:3085
Parameters
panel
Returns
void
onSlotPropertyChanged()?
onSlotPropertyChanged?(
kind,
slot,
slotInfo,
name,
value,
prev_value?
): boolean;Defined in: packages/core/src/LGraphNode.ts:3119
Parameters
kind
slot
number
slotInfo
| INodeInputSlot | INodeOutputSlot
name
string
value
any
prev_value?
any
Returns
boolean
onWidgetChanged()?
onWidgetChanged?(widget, oldValue?): void;Defined in: packages/core/src/LGraphNode.ts:3087
Parameters
widget
oldValue?
any
Returns
void
pin()
pin(v?): void;Defined in: packages/core/src/LGraphNode.ts:2867
Forces the node to do not move or realign on Z
Parameters
v?
boolean
Returns
void
removeInput()
removeInput(slot): void;Defined in: packages/core/src/LGraphNode.ts:1498
remove an existing input slot
Parameters
slot
number
Returns
void
removeOutput()
removeOutput(slot): void;Defined in: packages/core/src/LGraphNode.ts:1393
remove an existing output slot
Parameters
slot
number
Returns
void
serialize()
serialize(): SerializedLGraphNode;Defined in: packages/core/src/LGraphNode.ts:336
serialize the content
Returns
setDirtyCanvas()
setDirtyCanvas(fg, bg?): void;Defined in: packages/core/src/LGraphNode.ts:2805
Forces to redraw or the main canvas (LGraphNode) or the bg canvas (links)
Parameters
fg
boolean
bg?
boolean = false
Returns
void
setInputDataType()
setInputDataType(slot, type): void;Defined in: packages/core/src/LGraphNode.ts:853
sets the input data type
Parameters
slot
number
type
Returns
void
setInputSlotProperty()
setInputSlotProperty(
slot,
name,
value
): void;Defined in: packages/core/src/LGraphNode.ts:539
Parameters
slot
number
name
string
value
any
Returns
void
setOutputData()
setOutputData(slot, data): void;Defined in: packages/core/src/LGraphNode.ts:602
sets the output data
Parameters
slot
number
data
any
Returns
void
setOutputDataType()
setOutputDataType(slot, type): void;Defined in: packages/core/src/LGraphNode.ts:640
sets the output data
Parameters
slot
number
type
Returns
void
setOutputSlotProperty()
setOutputSlotProperty(
slot,
name,
value
): void;Defined in: packages/core/src/LGraphNode.ts:570
Parameters
slot
number
name
string
value
any
Returns
void
setProperty()
setProperty(name, value): void;Defined in: packages/core/src/LGraphNode.ts:476
sets the value of a property
Parameters
name
string
value
any
Returns
void
setSize()
setSize(size): void;Defined in: packages/core/src/LGraphNode.ts:1309
changes node size and triggers callback
Parameters
size
Returns
void
Method
setSize
setWidgetHidden()
setWidgetHidden(widget, hidden): void;Defined in: packages/core/src/LGraphNode.ts:1771
Parameters
widget
hidden
boolean
Returns
void
toString()
toString(): string;Defined in: packages/core/src/LGraphNode.ts:446
serialize and stringify
Returns
string
trace()
trace(msg): void;Defined in: packages/core/src/LGraphNode.ts:2790
Console output
Parameters
msg
string
Returns
void
trigger()
trigger(
action,
param?,
options?
): void;Defined in: packages/core/src/LGraphNode.ts:1171
Triggers an event in this node, this will trigger any output with the same name
Parameters
action
string
param?
any
options?
Returns
void
triggerSlot()
triggerSlot(
slot,
param?,
link_id?,
options?
): void;Defined in: packages/core/src/LGraphNode.ts:1193
Triggers an slot event in this node
Parameters
slot
number
the index of the output slot
param?
any
link_id?
in case you want to trigger and specific output link in a slot
options?
LActionOptions = {}
Returns
void
updateOutputData()?
updateOutputData?(slot): void;Defined in: packages/core/src/LGraphNode.ts:3105
Parameters
slot
number
Returns
void