Skip to content

@gausszhou/litegraph-core / LGraphCanvas

Class: LGraphCanvas ​

Defined in: packages/core/src/LGraphCanvas.ts:119

This class is in charge of rendering one graph inside a canvas. And provides all the interaction required. Valid callbacks are: onNodeSelected, onNodeDeselected, onShowNodePanel, onNodeDblClicked

Param ​

canvas

the canvas where you want to render (it accepts a selector in string format or the canvas element itself)

Param ​

graph

Param ​

options

Extends ​

Constructors ​

Constructor ​

ts
new LGraphCanvas(
   canvas, 
   graph?, 
   options?
): LGraphCanvas;

Defined in: packages/core/src/LGraphCanvas.ts:207

Parameters ​

canvas ​

string | HTMLCanvasElement

graph? ​

LGraph

options? ​
autoresize? ​

boolean

skip_events? ​

boolean

skip_render? ​

boolean

viewport? ​

Vector4

Returns ​

LGraphCanvas

Inherited from ​

LGraphCanvas_Rendering.constructor

Properties ​

_bg_img ​

ts
_bg_img: HTMLImageElement | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:431


_graph_stack ​

ts
_graph_stack: GraphStackEntry[] | null = [];

Defined in: packages/core/src/LGraphCanvas.ts:429


_highlight_input ​

ts
_highlight_input: Vector2 | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:425


_highlight_input_slot ​

ts
_highlight_input_slot: INodeSlot | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:426


_highlight_output ​

ts
_highlight_output: Vector2 | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:427


_key_callback? ​

ts
_key_callback?: (e) => any;

Defined in: packages/core/src/LGraphCanvas.ts:669

Parameters ​

e ​

any

Returns ​

any


_mousedown_callback? ​

ts
_mousedown_callback?: (e) => any;

Defined in: packages/core/src/LGraphCanvas.ts:665

Parameters ​

e ​

any

Returns ​

any


_mousemove_callback? ​

ts
_mousemove_callback?: (e) => any;

Defined in: packages/core/src/LGraphCanvas.ts:667

Parameters ​

e ​

any

Returns ​

any


_mouseup_callback? ​

ts
_mouseup_callback?: (e) => any;

Defined in: packages/core/src/LGraphCanvas.ts:668

Parameters ​

e ​

any

Returns ​

any


_mousewheel_callback? ​

ts
_mousewheel_callback?: (e) => any;

Defined in: packages/core/src/LGraphCanvas.ts:666

Parameters ​

e ​

any

Returns ​

any


_ondrop_callback? ​

ts
_ondrop_callback?: (e) => any;

Defined in: packages/core/src/LGraphCanvas.ts:670

Parameters ​

e ​

any

Returns ​

any


_pattern ​

ts
_pattern: CanvasPattern | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:432


_pattern_img ​

ts
_pattern_img: HTMLImageElement | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:433


align_to_grid ​

ts
align_to_grid: boolean = false;

Defined in: packages/core/src/LGraphCanvas.ts:268


allow_dragcanvas ​

ts
allow_dragcanvas: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:260


allow_dragnodes ​

ts
allow_dragnodes: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:261


allow_interaction ​

ts
allow_interaction: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:263

allow to control widgets, buttons, collapse, etc


ts
allow_reconnect_links: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:265

allows to change a connection with having to redo it again


ts
allow_searchbox: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:267

No effect


always_render_background ​

ts
always_render_background: boolean = false;

Defined in: packages/core/src/LGraphCanvas.ts:269


autoresize? ​

ts
autoresize?: boolean;

Defined in: packages/core/src/LGraphCanvas.ts:270


background_image ​

ts
background_image: string | null = LGraphCanvas.DEFAULT_BACKGROUND_IMAGE;

Defined in: packages/core/src/LGraphCanvas.ts:271


bgcanvas ​

ts
bgcanvas: HTMLCanvasElement;

Defined in: packages/core/src/LGraphCanvas.ts:272


bgctx ​

ts
bgctx: CanvasRenderingContext2D;

Defined in: packages/core/src/LGraphCanvas.ts:273


block_click ​

ts
block_click: boolean = false;

Defined in: packages/core/src/LGraphCanvas.ts:274


canvas ​

ts
canvas: HTMLCanvasElement;

Defined in: packages/core/src/LGraphCanvas.ts:275


canvas_mouse ​

ts
canvas_mouse: Vector2;

Defined in: packages/core/src/LGraphCanvas.ts:276


clear_background ​

ts
clear_background: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:277


connecting_input ​

ts
connecting_input: INodeInputSlot | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:281


connecting_node ​

ts
connecting_node: LGraphNode | null;

Defined in: packages/core/src/LGraphCanvas.ts:278


connecting_output ​

ts
connecting_output: INodeOutputSlot | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:282


connecting_pos ​

ts
connecting_pos: Vector2 | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:279


connecting_slot ​

ts
connecting_slot: number | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:280


connections_width ​

ts
connections_width: number = 3;

Defined in: packages/core/src/LGraphCanvas.ts:283


ctx ​

ts
ctx: CanvasRenderingContext2D;

Defined in: packages/core/src/LGraphCanvas.ts:284


current_node ​

ts
current_node: LGraphNode | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:285


ts
default_link_color: string;

Defined in: packages/core/src/LGraphCanvas.ts:286


dirty_area ​

ts
dirty_area: Vector4 | null;

Defined in: packages/core/src/LGraphCanvas.ts:287


dirty_bgcanvas? ​

ts
dirty_bgcanvas?: boolean;

Defined in: packages/core/src/LGraphCanvas.ts:288


dirty_canvas? ​

ts
dirty_canvas?: boolean;

Defined in: packages/core/src/LGraphCanvas.ts:289


drag_mode ​

ts
drag_mode: boolean = false;

Defined in: packages/core/src/LGraphCanvas.ts:290


dragging_canvas ​

ts
dragging_canvas: boolean;

Defined in: packages/core/src/LGraphCanvas.ts:291


dragging_rectangle ​

ts
dragging_rectangle: Float32Array<ArrayBufferLike> | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:292


ds ​

ts
ds: DragAndScale;

Defined in: packages/core/src/LGraphCanvas.ts:293


editor_alpha ​

ts
editor_alpha: number = 1;

Defined in: packages/core/src/LGraphCanvas.ts:295

used for transition


filter ​

ts
filter: any = null;

Defined in: packages/core/src/LGraphCanvas.ts:297

allows to filter to only accept some type of nodes in a graph


fps ​

ts
fps: number;

Defined in: packages/core/src/LGraphCanvas.ts:298


frame ​

ts
frame: number;

Defined in: packages/core/src/LGraphCanvas.ts:299


graph ​

ts
graph: LGraph;

Defined in: packages/core/src/LGraphCanvas.ts:300


graph_mouse ​

ts
graph_mouse: Vector2;

Defined in: packages/core/src/LGraphCanvas.ts:325

mouse in graph coordinates, where 0,0 is the top-left corner of the blue rectangle


ts
highlighted_links: Record<LinkID, boolean>;

Defined in: packages/core/src/LGraphCanvas.ts:301


highquality_render ​

ts
highquality_render: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:302


inner_text_font ​

ts
inner_text_font: string;

Defined in: packages/core/src/LGraphCanvas.ts:303


is_rendering ​

ts
is_rendering: boolean;

Defined in: packages/core/src/LGraphCanvas.ts:304


last_click_position ​

ts
last_click_position: Vector2;

Defined in: packages/core/src/LGraphCanvas.ts:313


last_click_position_offset ​

ts
last_click_position_offset: Vector2;

Defined in: packages/core/src/LGraphCanvas.ts:314


last_draw_time ​

ts
last_draw_time: number;

Defined in: packages/core/src/LGraphCanvas.ts:305


last_mouse ​

ts
last_mouse: Vector2;

Defined in: packages/core/src/LGraphCanvas.ts:306


last_mouse_dragging ​

ts
last_mouse_dragging: boolean = false;

Defined in: packages/core/src/LGraphCanvas.ts:317


last_mouse_position ​

ts
last_mouse_position: Vector2;

Defined in: packages/core/src/LGraphCanvas.ts:312

Possible duplicated with last_mousehttps://github.com/jagenjo/litegraph.js/issues/70


last_mouseclick ​

ts
last_mouseclick: number;

Defined in: packages/core/src/LGraphCanvas.ts:316

Timestamp of last mouse click, defaults to 0


ts
link_type_colors: Record<string, string> = {};

Defined in: packages/core/src/LGraphCanvas.ts:163


ts
links_render_mode: LinkRenderMode = LinkRenderMode.SPLINE_LINK;

Defined in: packages/core/src/LGraphCanvas.ts:318


live_mode ​

ts
live_mode: boolean = false;

Defined in: packages/core/src/LGraphCanvas.ts:319


maxZoom ​

ts
maxZoom: number | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:332


minZoom ​

ts
minZoom: number | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:333


mouse ​

ts
mouse: Vector2;

Defined in: packages/core/src/LGraphCanvas.ts:321

mouse in canvas coordinates, where 0,0 is the top-left corner of the blue rectangle


multi_select ​

ts
multi_select: boolean = false;

Defined in: packages/core/src/LGraphCanvas.ts:344

allow selecting multi nodes without pressing extra keys


node_capturing_input ​

ts
node_capturing_input: LGraphNode | null;

Defined in: packages/core/src/LGraphCanvas.ts:326


node_dragged ​

ts
node_dragged: LGraphNode | null;

Defined in: packages/core/src/LGraphCanvas.ts:327


node_in_panel ​

ts
node_in_panel: LGraphNode | null;

Defined in: packages/core/src/LGraphCanvas.ts:328


node_over ​

ts
node_over: LGraphNode | null;

Defined in: packages/core/src/LGraphCanvas.ts:329


node_panel ​

ts
node_panel: INodePanel | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:254


node_title_color ​

ts
node_title_color: string;

Defined in: packages/core/src/LGraphCanvas.ts:330


node_widget ​

ts
node_widget: 
  | [LGraphNode, IWidget<any, any>]
  | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:331


offset_mouse ​

ts
offset_mouse: Vector2;

Defined in: packages/core/src/LGraphCanvas.ts:323

mouse in offset coordinates, where 0,0 is the top-left corner of the canvas DOM element


options_panel ​

ts
options_panel: IGraphDialog | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:255


ts
over_link_center: LLink | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:345


pause_rendering ​

ts
pause_rendering: boolean = false;

Defined in: packages/core/src/LGraphCanvas.ts:388


pointer_is_double ​

ts
pointer_is_double: boolean = false;

Defined in: packages/core/src/LGraphCanvas.ts:423


pointer_is_down ​

ts
pointer_is_down: boolean = false;

Defined in: packages/core/src/LGraphCanvas.ts:422


prompt_box ​

ts
prompt_box: IGraphDialog | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:436


read_only ​

ts
read_only: boolean = false;

Defined in: packages/core/src/LGraphCanvas.ts:390

if set to true users cannot modify the graph


render_canvas_border ​

ts
render_canvas_border: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:391


render_collapsed_slots ​

ts
render_collapsed_slots: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:392


render_connection_arrows ​

ts
render_connection_arrows: boolean = false;

Defined in: packages/core/src/LGraphCanvas.ts:393


render_connections ​

ts
render_connections: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:397


render_connections_border ​

ts
render_connections_border: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:394


render_connections_shadows ​

ts
render_connections_shadows: boolean = false;

Defined in: packages/core/src/LGraphCanvas.ts:396

too much cpu


render_curved_connections ​

ts
render_curved_connections: boolean = false;

Defined in: packages/core/src/LGraphCanvas.ts:398


render_execution_order ​

ts
render_execution_order: boolean = false;

Defined in: packages/core/src/LGraphCanvas.ts:399


ts
render_link_tooltip: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:400


render_only_selected ​

ts
render_only_selected: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:401


render_shadows ​

ts
render_shadows: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:402


render_subgraph_panels ​

ts
render_subgraph_panels: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:404


render_subgraph_stack_header ​

ts
render_subgraph_stack_header: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:405


render_time ​

ts
render_time: number = 0;

Defined in: packages/core/src/LGraphCanvas.ts:258


render_title_colored ​

ts
render_title_colored: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:403


resizing_node ​

ts
resizing_node: LGraphNode | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:882


round_radius ​

ts
round_radius: number = 8;

Defined in: packages/core/src/LGraphCanvas.ts:406


ts
search_box: IGraphDialog | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:435


selected_group ​

ts
selected_group: LGraphGroup | null;

Defined in: packages/core/src/LGraphCanvas.ts:407


selected_group_moving ​

ts
selected_group_moving: boolean;

Defined in: packages/core/src/LGraphCanvas.ts:409


selected_group_resizing ​

ts
selected_group_resizing: boolean;

Defined in: packages/core/src/LGraphCanvas.ts:408


selected_nodes ​

ts
selected_nodes: Record<NodeID, LGraphNode>;

Defined in: packages/core/src/LGraphCanvas.ts:410


set_canvas_dirty_on_mouse_event ​

ts
set_canvas_dirty_on_mouse_event: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:412

forces to redraw the canvas if the mouse does anything


show_info ​

ts
show_info: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:413


skip_events ​

ts
skip_events: boolean = false;

Defined in: packages/core/src/LGraphCanvas.ts:307


title_text_font ​

ts
title_text_font: string;

Defined in: packages/core/src/LGraphCanvas.ts:414


use_gradients ​

ts
use_gradients: boolean = false;

Defined in: packages/core/src/LGraphCanvas.ts:416

set to true to render title bar with gradients


viewport ​

ts
viewport: Vector4 | null;

Defined in: packages/core/src/LGraphCanvas.ts:257


visible_area ​

ts
visible_area: Float32Array<ArrayBufferLike>;

Defined in: packages/core/src/LGraphCanvas.ts:417


ts
visible_links: LLink[] = [];

Defined in: packages/core/src/LGraphCanvas.ts:418


visible_nodes ​

ts
visible_nodes: LGraphNode[];

Defined in: packages/core/src/LGraphCanvas.ts:419


zoom_modify_alpha ​

ts
zoom_modify_alpha: boolean = true;

Defined in: packages/core/src/LGraphCanvas.ts:420


active_canvas ​

ts
static active_canvas: LGraphCanvas | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:251


active_node ​

ts
static active_node: LGraphNode | null = null;

Defined in: packages/core/src/LGraphCanvas.ts:252


DEFAULT_BACKGROUND_IMAGE ​

ts
static DEFAULT_BACKGROUND_IMAGE: string = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQBJREFUeNrs1rEKwjAUhlETUkj3vP9rdmr1Ysammk2w5wdxuLgcMHyptfawuZX4pJSWZTnfnu/lnIe/jNNxHHGNn//HNbbv+4dr6V+11uF527arU7+u63qfa/bnmh8sWLBgwYJlqRf8MEptXPBXJXa37BSl3ixYsGDBMliwFLyCV/DeLIMFCxYsWLBMwSt4Be/NggXLYMGCBUvBK3iNruC9WbBgwYJlsGApeAWv4L1ZBgsWLFiwYJmCV/AK3psFC5bBggULloJX8BpdwXuzYMGCBctgwVLwCl7Be7MMFixYsGDBsu8FH1FaSmExVfAxBa/gvVmwYMGCZbBg/W4vAQYA5tRF9QYlv/QAAAAASUVORK5CYII=";

Defined in: packages/core/src/LGraphCanvas.ts:120


DEFAULT_CONNECTION_COLORS ​

ts
static DEFAULT_CONNECTION_COLORS: {
  input_off: string;
  input_on: string;
  output_off: string;
  output_on: string;
};

Defined in: packages/core/src/LGraphCanvas.ts:141

input_off ​

ts
input_off: string;

input_on ​

ts
input_on: string;

output_off ​

ts
output_off: string;

output_on ​

ts
output_on: string;

DEFAULT_CONNECTION_COLORS_BY_TYPE ​

ts
static DEFAULT_CONNECTION_COLORS_BY_TYPE: Record<string, string>;

Defined in: packages/core/src/LGraphCanvas.ts:152


DEFAULT_CONNECTION_COLORS_BY_TYPE_OFF ​

ts
static DEFAULT_CONNECTION_COLORS_BY_TYPE_OFF: Record<string, string>;

Defined in: packages/core/src/LGraphCanvas.ts:157


ts
static DEFAULT_LINK_TYPE_COLORS: Record<string, string>;

Defined in: packages/core/src/LGraphCanvas.ts:134


gradients ​

ts
static gradients: Record<string, CanvasGradient> = {};

Defined in: packages/core/src/LGraphCanvas.ts:165


node_colors ​

ts
static node_colors: Record<string, NodeColor>;

Defined in: packages/core/src/LGraphCanvas.ts:122


onGroupAdd ​

ts
static onGroupAdd: ContextMenuEventListener = LGraphCanvas_UI.onGroupAdd;

Defined in: packages/core/src/LGraphCanvas.ts:2150

Create menu for Add Group

Inherited from ​

LGraphCanvas_UI.onGroupAdd


onMenuAdd ​

ts
static onMenuAdd: (_value, _options, mouseEvent, prevMenu, callback?) => false | undefined = LGraphCanvas_UI.onMenuAdd;

Defined in: packages/core/src/LGraphCanvas.ts:2151

Create menu for Add Node

Create menu for Add Node

Parameters ​

_value ​

IContextMenuItem

_options ​

IContextMenuOptions

mouseEvent ​

MouseEventExt

prevMenu ​

ContextMenu

callback? ​

(node) => void

Returns ​

false | undefined

Inherited from ​

LGraphCanvas_UI.onMenuAdd


onMenuCollapseAll ​

ts
static onMenuCollapseAll: () => void = LGraphCanvas_UI.onMenuCollapseAll;

Defined in: packages/core/src/LGraphCanvas.ts:2147

Returns ​

void

Inherited from ​

LGraphCanvas_UI.onMenuCollapseAll


onMenuNodeClone ​

ts
static onMenuNodeClone: ContextMenuEventListener = LGraphCanvas_UI.onMenuNodeClone;

Defined in: packages/core/src/LGraphCanvas.ts:2163

Inherited from ​

LGraphCanvas_UI.onMenuNodeClone


onMenuNodeCollapse ​

ts
static onMenuNodeCollapse: ContextMenuEventListener = LGraphCanvas_UI.onMenuNodeCollapse;

Defined in: packages/core/src/LGraphCanvas.ts:2157

Inherited from ​

LGraphCanvas_UI.onMenuNodeCollapse


onMenuNodeColors ​

ts
static onMenuNodeColors: ContextMenuEventListener = LGraphCanvas_UI.onMenuNodeColors;

Defined in: packages/core/src/LGraphCanvas.ts:2160

Inherited from ​

LGraphCanvas_UI.onMenuNodeColors


onMenuNodeEdit ​

ts
static onMenuNodeEdit: () => void = LGraphCanvas_UI.onMenuNodeEdit;

Defined in: packages/core/src/LGraphCanvas.ts:2148

Returns ​

void

Inherited from ​

LGraphCanvas_UI.onMenuNodeEdit


onMenuNodeMode ​

ts
static onMenuNodeMode: ContextMenuEventListener = LGraphCanvas_UI.onMenuNodeMode;

Defined in: packages/core/src/LGraphCanvas.ts:2159

Inherited from ​

LGraphCanvas_UI.onMenuNodeMode


onMenuNodePin ​

ts
static onMenuNodePin: ContextMenuEventListener = LGraphCanvas_UI.onMenuNodePin;

Defined in: packages/core/src/LGraphCanvas.ts:2158

Inherited from ​

LGraphCanvas_UI.onMenuNodePin


onMenuNodeRemove ​

ts
static onMenuNodeRemove: ContextMenuEventListener = LGraphCanvas_UI.onMenuNodeRemove;

Defined in: packages/core/src/LGraphCanvas.ts:2162

Inherited from ​

LGraphCanvas_UI.onMenuNodeRemove


onMenuNodeShapes ​

ts
static onMenuNodeShapes: ContextMenuEventListener = LGraphCanvas_UI.onMenuNodeShapes;

Defined in: packages/core/src/LGraphCanvas.ts:2161

Inherited from ​

LGraphCanvas_UI.onMenuNodeShapes


onMenuNodeToParentGraph ​

ts
static onMenuNodeToParentGraph: ContextMenuEventListener = LGraphCanvas_UI.onMenuNodeToParentGraph;

Defined in: packages/core/src/LGraphCanvas.ts:2167

Inherited from ​

LGraphCanvas_UI.onMenuNodeToParentGraph


onMenuNodeToSubgraph ​

ts
static onMenuNodeToSubgraph: ContextMenuEventListener = LGraphCanvas_UI.onMenuNodeToSubgraph;

Defined in: packages/core/src/LGraphCanvas.ts:2164

Inherited from ​

LGraphCanvas_UI.onMenuNodeToSubgraph


onMenuNodeToSubgraphInputs ​

ts
static onMenuNodeToSubgraphInputs: ContextMenuEventListener = LGraphCanvas_UI.onMenuNodeToSubgraphInputs;

Defined in: packages/core/src/LGraphCanvas.ts:2165

Inherited from ​

LGraphCanvas_UI.onMenuNodeToSubgraphInputs


onMenuNodeToSubgraphOutputs ​

ts
static onMenuNodeToSubgraphOutputs: ContextMenuEventListener = LGraphCanvas_UI.onMenuNodeToSubgraphOutputs;

Defined in: packages/core/src/LGraphCanvas.ts:2166

Inherited from ​

LGraphCanvas_UI.onMenuNodeToSubgraphOutputs


onMenuResizeNode ​

ts
static onMenuResizeNode: ContextMenuEventListener = LGraphCanvas_UI.onMenuResizeNode;

Defined in: packages/core/src/LGraphCanvas.ts:2156

Inherited from ​

LGraphCanvas_UI.onMenuResizeNode


onResizeNode ​

ts
static onResizeNode: ContextMenuEventListener = LGraphCanvas_UI.onResizeNode;

Defined in: packages/core/src/LGraphCanvas.ts:2155

Inherited from ​

LGraphCanvas_UI.onResizeNode


onShowMenuNodeProperties ​

ts
static onShowMenuNodeProperties: ContextMenuEventListener = LGraphCanvas_UI.onShowMenuNodeProperties;

Defined in: packages/core/src/LGraphCanvas.ts:2154

Inherited from ​

LGraphCanvas_UI.onShowMenuNodeProperties


onShowPropertyEditor ​

ts
static onShowPropertyEditor: ContextMenuEventListener = LGraphCanvas_UI.onShowPropertyEditor;

Defined in: packages/core/src/LGraphCanvas.ts:2149

Inherited from ​

LGraphCanvas_UI.onShowPropertyEditor


search_limit ​

ts
static search_limit: number;

Defined in: packages/core/src/LGraphCanvas.ts:166


showMenuNodeOptionalInputs ​

ts
static showMenuNodeOptionalInputs: ContextMenuEventListener = LGraphCanvas_UI.showMenuNodeOptionalInputs;

Defined in: packages/core/src/LGraphCanvas.ts:2152

Inherited from ​

LGraphCanvas_UI.showMenuNodeOptionalInputs


showMenuNodeOptionalOutputs ​

ts
static showMenuNodeOptionalOutputs: ContextMenuEventListener = LGraphCanvas_UI.showMenuNodeOptionalOutputs;

Defined in: packages/core/src/LGraphCanvas.ts:2153

Inherited from ​

LGraphCanvas_UI.showMenuNodeOptionalOutputs

Accessors ​

scale ​

Get Signature ​

ts
get scale(): number;

Defined in: packages/core/src/LGraphCanvas.ts:335

Returns ​

number

Set Signature ​

ts
set scale(v): void;

Defined in: packages/core/src/LGraphCanvas.ts:339

Parameters ​
v ​

number

Returns ​

void

Methods ​

addGraphInputNode() ​

ts
addGraphInputNode(
   this, 
   subgraphNode, 
   name, 
   type
): void;

Defined in: packages/core/src/LGraphCanvas.ts:2080

Parameters ​

this ​

LGraphCanvas

subgraphNode ​

Subgraph

name ​

string

type ​

SlotType

Returns ​

void


addGraphOutputNode() ​

ts
addGraphOutputNode(
   this, 
   subgraphNode, 
   name, 
   type
): void;

Defined in: packages/core/src/LGraphCanvas.ts:2111

Parameters ​

this ​

LGraphCanvas

subgraphNode ​

Subgraph

name ​

string

type ​

SlotType

Returns ​

void


adjustCanvasForHiDPI() ​

ts
adjustCanvasForHiDPI(ratio?): void;

Defined in: packages/core/src/LGraphCanvas.ts:838

Parameters ​

ratio? ​

number

Returns ​

void


adjustMouseEvent() ​

ts
adjustMouseEvent(_e): MouseEventExt;

Defined in: packages/core/src/LGraphCanvas.ts:1755

adds some useful properties to a mouse event, like the position in graph coordinates

Parameters ​

_e ​

MouseEvent

Returns ​

MouseEventExt

Method ​

adjustMouseEvent


adjustNodesSize() ​

ts
adjustNodesSize(): void;

Defined in: packages/core/src/LGraphCanvas.ts:1978

Returns ​

void


bindEvents() ​

ts
bindEvents(): void;

Defined in: packages/core/src/LGraphCanvas.ts:687

binds mouse, keyboard, touch and drag events to the canvas

Returns ​

void


blockClick() ​

ts
blockClick(): void;

Defined in: packages/core/src/LGraphCanvas.ts:877

Returns ​

void


bringToFront() ​

ts
bringToFront(this, node): void;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:25

brings a node to front (above all other nodes)

Parameters ​

this ​

LGraphCanvas

node ​

LGraphNode

Returns ​

void

Inherited from ​

LGraphCanvas_Rendering.bringToFront


centerOnNode() ​

ts
centerOnNode(node): void;

Defined in: packages/core/src/LGraphCanvas.ts:1739

centers the camera on a given node

Parameters ​

node ​

LGraphNode

Returns ​

void


checkDropItem() ​

ts
checkDropItem(_e): void;

Defined in: packages/core/src/LGraphCanvas.ts:1550

Parameters ​

_e ​

DragEvent

Returns ​

void


checkPanels() ​

ts
checkPanels(this): void;

Defined in: packages/core/src/LGraphCanvas_UI.ts:3056

Parameters ​

this ​

LGraphCanvas

Returns ​

void

Inherited from ​

LGraphCanvas_UI.checkPanels


clear() ​

ts
clear(): void;

Defined in: packages/core/src/LGraphCanvas.ts:439

clears all the data inside

Returns ​

void


cloneSelection() ​

ts
cloneSelection(): void;

Defined in: packages/core/src/LGraphCanvas.ts:1419

Returns ​

void


closeAllSubgraphs() ​

ts
closeAllSubgraphs(): void;

Defined in: packages/core/src/LGraphCanvas.ts:557

Returns ​

void


closePanels() ​

ts
closePanels(): void;

Defined in: packages/core/src/LGraphCanvas_UI.ts:3079

Returns ​

void

Inherited from ​

LGraphCanvas_UI.closePanels


closeSubgraph() ​

ts
closeSubgraph(): void;

Defined in: packages/core/src/LGraphCanvas.ts:564

closes a subgraph contained inside a node

Returns ​

void


computeConnectionPoint() ​

ts
computeConnectionPoint(
   this, 
   a, 
   b, 
   t, 
   startDir?, 
   endDir?
): Vector2;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:1957

Parameters ​

this ​

LGraphCanvas

a ​

Vector2

b ​

Vector2

t ​

number

startDir? ​

Dir = Dir.RIGHT

endDir? ​

Dir = Dir.LEFT

Returns ​

Vector2

Inherited from ​

LGraphCanvas_Rendering.computeConnectionPoint


computeVisibleNodes() ​

ts
computeVisibleNodes(
   this, 
   nodes, 
   out?
): LGraphNode[];

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:49

checks which nodes are visible (inside the camera area)

Parameters ​

this ​

LGraphCanvas

nodes ​

LGraphNode[]

out? ​

LGraphNode[] = []

Returns ​

LGraphNode[]

Inherited from ​

LGraphCanvas_Rendering.computeVisibleNodes


convertCanvasToOffset() ​

ts
convertCanvasToOffset(pos, out?): Vector2;

Defined in: packages/core/src/LGraphCanvas.ts:2067

Parameters ​

pos ​

Vector2

out? ​

Vector2 = ...

Returns ​

Vector2


convertEventToCanvasOffset() ​

ts
convertEventToCanvasOffset(this, e): Vector2;

Defined in: packages/core/src/LGraphCanvas.ts:2072

converts event coordinates from canvas2D to graph coordinates

Parameters ​

this ​

LGraphCanvas

e ​

MouseEventExt

Returns ​

Vector2


convertOffsetToCanvas() ​

ts
convertOffsetToCanvas(pos): Vector2;

Defined in: packages/core/src/LGraphCanvas.ts:2063

Parameters ​

pos ​

Vector2

Returns ​

Vector2


copyToClipboard() ​

ts
copyToClipboard(): void;

Defined in: packages/core/src/LGraphCanvas.ts:1290

Returns ​

void


createDefaultNodeForSlot() ​

ts
createDefaultNodeForSlot(nodeType, opts?): boolean;

Defined in: packages/core/src/LGraphCanvas.ts:884

Parameters ​

nodeType ​

NodeTypeSpec

opts? ​

LCreateDefaultNodeForSlotOptions = {}

Returns ​

boolean


createDialog() ​

ts
createDialog(
   this, 
   html, 
   options?
): IGraphDialog;

Defined in: packages/core/src/LGraphCanvas_UI.ts:2358

Parameters ​

this ​

LGraphCanvas

html ​

string

options? ​

GraphDialogOptions = ...

Returns ​

IGraphDialog

Inherited from ​

LGraphCanvas_UI.createDialog


createPanel() ​

ts
createPanel(title, options?): IGraphPanel;

Defined in: packages/core/src/LGraphCanvas_UI.ts:2846

Parameters ​

title ​

string

options? ​
closable? ​

boolean

height? ​

number

onClose? ​

() => void

onOpen? ​

() => void

width? ​

number

window? ​

Window

Returns ​

IGraphPanel

Inherited from ​

LGraphCanvas_UI.createPanel


cutToClipboard() ​

ts
cutToClipboard(): void;

Defined in: packages/core/src/LGraphCanvas.ts:1285

Returns ​

void


deleteSelectedNodes() ​

ts
deleteSelectedNodes(): void;

Defined in: packages/core/src/LGraphCanvas.ts:1708

deletes all nodes in the current selection from the graph

Returns ​

void


deselectAllNodes() ​

ts
deselectAllNodes(): void;

Defined in: packages/core/src/LGraphCanvas.ts:1681

removes all nodes from the current selection

Returns ​

void


deselectNode() ​

ts
deselectNode(node): void;

Defined in: packages/core/src/LGraphCanvas.ts:1648

removes a node from the current selection

Parameters ​

node ​

LGraphNode

Returns ​

void


draw() ​

ts
draw(
   this, 
   forceFG?, 
   forceBG?
): void;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:71

renders the whole canvas content, by rendering in two separated canvas, one containing the background grid and the connections, and one containing the nodes)

Parameters ​

this ​

LGraphCanvas

forceFG? ​

boolean = false

forceBG? ​

boolean = false

Returns ​

void

Inherited from ​

LGraphCanvas_Rendering.draw


drawBackCanvas() ​

ts
drawBackCanvas(this): void;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:581

draws the back canvas (the one containing the background and the connections)

Parameters ​

this ​

LGraphCanvas

Returns ​

void

Inherited from ​

LGraphCanvas_Rendering.drawBackCanvas


drawButton() ​

ts
drawButton(
   this, 
   x, 
   y, 
   w, 
   h, 
   text?, 
   bgcolor?, 
   hovercolor?, 
   textcolor?, 
   ignore_readonly?
): boolean;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:477

Parameters ​

this ​

LGraphCanvas

x ​

number

y ​

number

w ​

number

h ​

number

text? ​

string

bgcolor? ​

string = LiteGraph.NODE_DEFAULT_COLOR

hovercolor? ​

string = "#555"

textcolor? ​

string = LiteGraph.NODE_TEXT_COLOR

ignore_readonly? ​

boolean = false

Returns ​

boolean

Inherited from ​

LGraphCanvas_Rendering.drawButton


drawConnections() ​

ts
drawConnections(this, ctx): void;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:1547

draws every connection visible in the canvas

Parameters ​

this ​

LGraphCanvas

ctx ​

CanvasRenderingContext2D

Returns ​

void

Inherited from ​

LGraphCanvas_Rendering.drawConnections


drawExecutionOrder() ​

ts
drawExecutionOrder(this, ctx): void;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:2011

Parameters ​

this ​

LGraphCanvas

ctx ​

CanvasRenderingContext2D

Returns ​

void

Inherited from ​

LGraphCanvas_Rendering.drawExecutionOrder


drawFrontCanvas() ​

ts
drawFrontCanvas(this): void;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:105

draws the front canvas (the one containing all the nodes)

Parameters ​

this ​

LGraphCanvas

Returns ​

void

Inherited from ​

LGraphCanvas_Rendering.drawFrontCanvas


drawGroups() ​

ts
drawGroups(
   this, 
   canvas, 
   ctx
): void;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:515

draws every group area in the background

Parameters ​

this ​

LGraphCanvas

canvas ​

HTMLCanvasElement

ctx ​

CanvasRenderingContext2D

Returns ​

void

Inherited from ​

LGraphCanvas_Rendering.drawGroups


drawLinkTooltip() ​

ts
drawLinkTooltip(
   this, 
   ctx, 
   link
): void;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:1166

used by this.over_link_center

Parameters ​

this ​

LGraphCanvas

ctx ​

CanvasRenderingContext2D

LLink

Returns ​

void

Inherited from ​

LGraphCanvas_Rendering.drawLinkTooltip


drawNode() ​

ts
drawNode(
   this, 
   node, 
   ctx
): void;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:749

draws the given node inside the canvas

Parameters ​

this ​

LGraphCanvas

node ​

LGraphNode

ctx ​

CanvasRenderingContext2D

Returns ​

void

Inherited from ​

LGraphCanvas_Rendering.drawNode


drawNodeShape() ​

ts
drawNodeShape(
   this, 
   node, 
   ctx, 
   size, 
   fgColor, 
   bgColor, 
   selected, 
   mouseOver
): void;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:1227

draws the shape of the given node in the canvas

Parameters ​

this ​

LGraphCanvas

node ​

LGraphNode

ctx ​

CanvasRenderingContext2D

size ​

Vector2

fgColor ​

string

bgColor ​

string

selected ​

boolean

mouseOver ​

boolean

Returns ​

void

Inherited from ​

LGraphCanvas_Rendering.drawNodeShape


drawNodeWidgets() ​

ts
drawNodeWidgets(
   this, 
   node, 
   posY, 
   ctx, 
   activeWidget
): void;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:2048

draws the widgets stored inside a node

Parameters ​

this ​

LGraphCanvas

node ​

LGraphNode

posY ​

number

ctx ​

CanvasRenderingContext2D

activeWidget ​

object

Returns ​

void

Inherited from ​

LGraphCanvas_Rendering.drawNodeWidgets


drawSubgraphPanel() ​

ts
drawSubgraphPanel(this, ctx): void;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:368

draws the panel in the corner that shows subgraph properties

Parameters ​

this ​

LGraphCanvas

ctx ​

CanvasRenderingContext2D

Returns ​

void

Method ​

drawSubgraphPanel

Inherited from ​

LGraphCanvas_Rendering.drawSubgraphPanel


drawSubgraphPanelLeft() ​

ts
drawSubgraphPanelLeft(
   this, 
   subgraph, 
   subnode, 
   ctx
): void;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:379

Parameters ​

this ​

LGraphCanvas

subgraph ​

LGraph

subnode ​

LGraphNode

ctx ​

CanvasRenderingContext2D

Returns ​

void

Inherited from ​

LGraphCanvas_Rendering.drawSubgraphPanelLeft


drawSubgraphPanelRight() ​

ts
drawSubgraphPanelRight(
   this, 
   subgraph, 
   subnode, 
   ctx
): void;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:427

Parameters ​

this ​

LGraphCanvas

subgraph ​

LGraph

subnode ​

LGraphNode

ctx ​

CanvasRenderingContext2D

Returns ​

void

Inherited from ​

LGraphCanvas_Rendering.drawSubgraphPanelRight


enableWebGL() ​

ts
enableWebGL(): void;

Defined in: packages/core/src/LGraphCanvas.ts:796

this function allows to render the canvas using WebGL instead of Canvas2D this is useful if you plant to render 3D objects inside your nodes, it uses litegl.js for webgl and canvas2DtoWebGL to emulate the Canvas2D calls in webGL

Returns ​

void


findLinkCenterAtPos() ​

ts
findLinkCenterAtPos(x, y): LLink | null;

Defined in: packages/core/src/LGraphCanvas.ts:1148

Parameters ​

x ​

number

y ​

number

Returns ​

LLink | null


getCanvasMenuOptions() ​

ts
getCanvasMenuOptions(this): ContextMenuItem[];

Defined in: packages/core/src/LGraphCanvas_UI.ts:2457

Parameters ​

this ​

LGraphCanvas

Returns ​

ContextMenuItem[]

Inherited from ​

LGraphCanvas_UI.getCanvasMenuOptions


getCanvasWindow() ​

ts
getCanvasWindow(): Window;

Defined in: packages/core/src/LGraphCanvas.ts:830

Used to attach the canvas in a popup

Returns ​

Window

the window where the canvas is attached (the DOM root node)


getExtraLinkMenuOptions()? ​

ts
getExtraLinkMenuOptions?(
   graphCanvas, 
   link, 
   options
): ContextMenuItem[] | null;

Defined in: packages/core/src/LGraphCanvas.ts:387

Parameters ​

graphCanvas ​

LGraphCanvas

LLink

options ​

ContextMenuItem[]

Returns ​

ContextMenuItem[] | null


getExtraMenuOptions()? ​

ts
getExtraMenuOptions?(graphCanvas, options): ContextMenuItem[] | null;

Defined in: packages/core/src/LGraphCanvas.ts:386

Called by getCanvasMenuOptions, append to default options

Parameters ​

graphCanvas ​

LGraphCanvas

options ​

ContextMenuItem[]

Returns ​

ContextMenuItem[] | null


getGroupMenuOptions() ​

ts
getGroupMenuOptions(this, group): ContextMenuItem[];

Defined in: packages/core/src/LGraphCanvas_UI.ts:2660

Parameters ​

this ​

LGraphCanvas

group ​

LGraphGroup

Returns ​

ContextMenuItem[]

Inherited from ​

LGraphCanvas_UI.getGroupMenuOptions


getLinkMenuOptions() ​

ts
getLinkMenuOptions(this, link): ContextMenuItem[];

Defined in: packages/core/src/LGraphCanvas_UI.ts:2115

Parameters ​

this ​

LGraphCanvas

LLink

Returns ​

ContextMenuItem[]

Inherited from ​

LGraphCanvas_UI.getLinkMenuOptions


getMenuOptions()? ​

ts
getMenuOptions?(graphCanvas): ContextMenuItem[];

Defined in: packages/core/src/LGraphCanvas.ts:384

Called by getCanvasMenuOptions, replace default options

Parameters ​

graphCanvas ​

LGraphCanvas

Returns ​

ContextMenuItem[]


getNodeMenuOptions() ​

ts
getNodeMenuOptions(this, node): ContextMenuItem[];

Defined in: packages/core/src/LGraphCanvas_UI.ts:2495

Parameters ​

this ​

LGraphCanvas

node ​

LGraphNode

Returns ​

ContextMenuItem[]

Inherited from ​

LGraphCanvas_UI.getNodeMenuOptions


isAreaClicked() ​

ts
isAreaClicked(
   this, 
   x, 
   y, 
   w, 
   h, 
   hold_click?
): boolean;

Defined in: packages/core/src/LGraphCanvas.ts:2009

Parameters ​

this ​

LGraphCanvas

x ​

number

y ​

number

w ​

number

h ​

number

hold_click? ​

boolean

Returns ​

boolean


isOverNodeBox() ​

ts
isOverNodeBox(
   node, 
   canvasX, 
   canvasY
): boolean;

Defined in: packages/core/src/LGraphCanvas.ts:1043

returns true if a position (in graph space) is on top of a node little corner box

Parameters ​

node ​

LGraphNode

canvasX ​

number

canvasY ​

number

Returns ​

boolean


isOverNodeInput() ​

ts
isOverNodeInput(
   node, 
   canvasX, 
   canvasY, 
   slotPos?
): number;

Defined in: packages/core/src/LGraphCanvas.ts:1061

returns slot index if a position (in graph space) is on top of a node input slot

Parameters ​

node ​

LGraphNode

canvasX ​

number

canvasY ​

number

slotPos? ​

Vector2

Returns ​

number


isOverNodeOutput() ​

ts
isOverNodeOutput(
   node, 
   canvasX, 
   canvasY, 
   slot_pos?
): number;

Defined in: packages/core/src/LGraphCanvas.ts:1106

returns the INDEX if a position (in graph space) is on top of a node output slot

Parameters ​

node ​

LGraphNode

canvasX ​

number

canvasY ​

number

slot_pos? ​

Vector2

Returns ​

number

Method ​

isOverNodeOuput


onClear()? ​

ts
onClear?(): void;

Defined in: packages/core/src/LGraphCanvas.ts:347

Called by LGraphCanvas.clear

Returns ​

void


onDrawBackground()? ​

ts
onDrawBackground?(ctx, visibleArea): void;

Defined in: packages/core/src/LGraphCanvas.ts:350

to render background objects (behind nodes and connections) in the canvas affected by transform

Parameters ​

ctx ​

CanvasRenderingContext2D

visibleArea ​

Float32Array

Returns ​

void


onDrawForeground()? ​

ts
onDrawForeground?(ctx, visibleArea): void;

Defined in: packages/core/src/LGraphCanvas.ts:353

to render foreground objects (above nodes and connections) in the canvas affected by transform

Parameters ​

ctx ​

CanvasRenderingContext2D

visibleArea ​

Float32Array

Returns ​

void


onDrawLinkTooltip()? ​

ts
onDrawLinkTooltip?(
   ctx, 
   link, 
   _this
): boolean | undefined;

Defined in: packages/core/src/LGraphCanvas.ts:362

called when rendering a tooltip

Parameters ​

ctx ​

CanvasRenderingContext2D

LLink | null

_this ​

LGraphCanvas

Returns ​

boolean | undefined


onDrawOverlay()? ​

ts
onDrawOverlay?(ctx): void;

Defined in: packages/core/src/LGraphCanvas.ts:355

to render foreground objects not affected by transform (for GUIs)

Parameters ​

ctx ​

CanvasRenderingContext2D

Returns ​

void


onDropItem()? ​

ts
onDropItem?(e): boolean | void;

Defined in: packages/core/src/LGraphCanvas.ts:356

Parameters ​

e ​

DragEvent

Returns ​

boolean | void


onHoverChange()? ​

ts
onHoverChange?(node, prevNode): void;

Defined in: packages/core/src/LGraphCanvas.ts:379

Parameters ​

node ​

LGraphNode | null

prevNode ​

LGraphNode | null

Returns ​

void


onMouse()? ​

ts
onMouse?(event): boolean;

Defined in: packages/core/src/LGraphCanvas.ts:358

Called by LGraphCanvas.processMouseDown

Parameters ​

event ​

MouseEventExt

Returns ​

boolean


onMouseDown()? ​

ts
onMouseDown?(event): boolean;

Defined in: packages/core/src/LGraphCanvas.ts:359

Parameters ​

event ​

MouseEventExt

Returns ​

boolean


onNodeDblClicked()? ​

ts
onNodeDblClicked?(node): void;

Defined in: packages/core/src/LGraphCanvas.ts:373

Called by LGraphCanvas.processNodeDblClicked

Parameters ​

node ​

LGraphNode

Returns ​

void


onNodeDeselected()? ​

ts
onNodeDeselected?(node): void;

Defined in: packages/core/src/LGraphCanvas.ts:369

Called by LGraphCanvas.deselectNode

Parameters ​

node ​

LGraphNode

Returns ​

void


onNodeMoved()? ​

ts
onNodeMoved?(node): void;

Defined in: packages/core/src/LGraphCanvas.ts:365

called after moving a node

Parameters ​

node ​

LGraphNode

Returns ​

void


onNodeSelected()? ​

ts
onNodeSelected?(node): void;

Defined in: packages/core/src/LGraphCanvas.ts:367

Called by LGraphCanvas.processNodeSelected

Parameters ​

node ​

LGraphNode

Returns ​

void


onNodeSelectionChange() ​

ts
onNodeSelectionChange(): void;

Defined in: packages/core/src/LGraphCanvas.ts:2057

Returns ​

void


onRender()? ​

ts
onRender?(canvas, ctx): void;

Defined in: packages/core/src/LGraphCanvas.ts:374

Parameters ​

canvas ​

HTMLCanvasElement

ctx ​

CanvasRenderingContext2D

Returns ​

void

Inherited from ​

LGraphCanvas_Rendering.onRender


onRenderBackground()? ​

ts
onRenderBackground?(canvas, ctx): boolean | void;

Defined in: packages/core/src/LGraphCanvas.ts:375

Parameters ​

canvas ​

HTMLCanvasElement

ctx ​

CanvasRenderingContext2D

Returns ​

boolean | void


onSearchBox()? ​

ts
onSearchBox?(
   helper, 
   value, 
   graphCanvas
): string[];

Defined in: packages/core/src/LGraphCanvas.ts:381

Called by LGraphCanvas.showSearchBox

Parameters ​

helper ​

Element

value ​

string

graphCanvas ​

LGraphCanvas

Returns ​

string[]


onSearchBoxSelection()? ​

ts
onSearchBoxSelection?(
   name, 
   event, 
   graphCanvas
): void;

Defined in: packages/core/src/LGraphCanvas.ts:382

Parameters ​

name ​

string

event ​

MouseEvent

graphCanvas ​

LGraphCanvas

Returns ​

void


onSelectionChange()? ​

ts
onSelectionChange?(nodes): void;

Defined in: packages/core/src/LGraphCanvas.ts:378

called if the selection changes

Parameters ​

nodes ​

Record<number, LGraphNode>

Returns ​

void


onShowNodePanel()? ​

ts
onShowNodePanel?(node): void;

Defined in: packages/core/src/LGraphCanvas.ts:371

Called by LGraphCanvas.processNodeDblClicked

Parameters ​

node ​

LGraphNode

Returns ​

void


openSubgraph() ​

ts
openSubgraph(graph): void;

Defined in: packages/core/src/LGraphCanvas.ts:506

opens a graph contained inside a node in the current graph

Parameters ​

graph ​

LGraph

Returns ​

void


pasteFromClipboard() ​

ts
pasteFromClipboard(): void;

Defined in: packages/core/src/LGraphCanvas.ts:1352

Returns ​

void


processContextMenu() ​

ts
processContextMenu(
   this, 
   target, 
   _event
): void;

Defined in: packages/core/src/LGraphCanvas_UI.ts:2685

Called when mouse right click

Parameters ​

this ​

LGraphCanvas

target ​

| IContextMenuTarget<any> | null

_event ​

Event

Returns ​

void

Inherited from ​

LGraphCanvas_UI.processContextMenu


processDrop() ​

ts
processDrop(_e): boolean | undefined;

Defined in: packages/core/src/LGraphCanvas.ts:1474

Parameters ​

_e ​

DragEvent

Returns ​

boolean | undefined


processKey() ​

ts
processKey(e): boolean | undefined;

Defined in: packages/core/src/LGraphCanvas.ts:1172

process a key event

Parameters ​

e ​

KeyboardEvent

Returns ​

boolean | undefined


processMouseDown() ​

ts
processMouseDown(this, _e): boolean | undefined;

Defined in: packages/core/src/LGraphCanvas_Events.ts:9

Parameters ​

this ​

LGraphCanvas

_e ​

MouseEvent

Returns ​

boolean | undefined

Inherited from ​

LGraphCanvas_Events.processMouseDown


processMouseMove() ​

ts
processMouseMove(this, _e): boolean | undefined;

Defined in: packages/core/src/LGraphCanvas_Events.ts:521

Parameters ​

this ​

LGraphCanvas

_e ​

MouseEvent

Returns ​

boolean | undefined

Inherited from ​

LGraphCanvas_Events.processMouseMove


processMouseUp() ​

ts
processMouseUp(this, _e): boolean | undefined;

Defined in: packages/core/src/LGraphCanvas_Events.ts:782

Parameters ​

this ​

LGraphCanvas

_e ​

MouseEvent

Returns ​

boolean | undefined

Inherited from ​

LGraphCanvas_Events.processMouseUp


processMouseWheel() ​

ts
processMouseWheel(this, _e): boolean | undefined;

Defined in: packages/core/src/LGraphCanvas_Events.ts:1095

Parameters ​

this ​

LGraphCanvas

_e ​

MouseEvent

Returns ​

boolean | undefined

Inherited from ​

LGraphCanvas_Events.processMouseWheel


processNodeDblClicked() ​

ts
processNodeDblClicked(n): void;

Defined in: packages/core/src/LGraphCanvas.ts:1573

Parameters ​

n ​

LGraphNode

Returns ​

void


processNodeSelected() ​

ts
processNodeSelected(node, e): void;

Defined in: packages/core/src/LGraphCanvas.ts:1588

Parameters ​

node ​

LGraphNode

e ​

MouseEvent

Returns ​

void


processNodeWidgets() ​

ts
processNodeWidgets(
   node, 
   pos, 
   event, 
   activeWidget?
): IWidget<any, any> | null;

Defined in: packages/core/src/LGraphCanvas.ts:1785

process an event on widgets

Parameters ​

node ​

LGraphNode

pos ​

Vector2

event ​

MouseEventExt

activeWidget? ​

object

Returns ​

IWidget<any, any> | null


prompt() ​

ts
prompt(
   this, 
   title?, 
   value, 
   callback, 
   event, 
   multiline?, 
   inputStyle?
): IGraphDialog;

Defined in: packages/core/src/LGraphCanvas_UI.ts:819

Parameters ​

this ​

LGraphCanvas

title? ​

string = ""

value ​

any

callback ​

(...args) => void

event ​

any

multiline? ​

boolean = false

inputStyle? ​

Partial<CSSStyleDeclaration> | null = null

Returns ​

IGraphDialog

Inherited from ​

LGraphCanvas_UI.prompt


renderInfo() ​

ts
renderInfo(
   this, 
   ctx, 
   x?, 
   y?
): void;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:559

draws some useful stats in the corner of the canvas

Parameters ​

this ​

LGraphCanvas

ctx ​

CanvasRenderingContext2D

x? ​

number = 10

y? ​

number

Returns ​

void

Inherited from ​

LGraphCanvas_Rendering.renderInfo


ts
renderLink(
   this, 
   ctx, 
   a, 
   b, 
   link, 
   skipBorder, 
   flow, 
   color?, 
   startDir?, 
   endDir?, 
   numSublines?
): void;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:1683

draws a link between two points

Parameters ​

this ​

LGraphCanvas

ctx ​

CanvasRenderingContext2D

a ​

Vector2

start pos

b ​

Vector2

end pos

LLink

the link object with all the link info

skipBorder ​

boolean

ignore the shadow of the link

flow ​

boolean

show flow animation (for events)

color? ​

string

the color for the link

startDir? ​

Dir

the direction enum

endDir? ​

Dir

the direction enum

numSublines? ​

number

number of sublines (useful to represent vec3 or rgb)

Returns ​

void

Inherited from ​

LGraphCanvas_Rendering.renderLink


resize() ​

ts
resize(width?, height?): void;

Defined in: packages/core/src/LGraphCanvas.ts:1988

resizes the canvas to a given size, if no size is passed, then it tries to fill the parentNode

Parameters ​

width? ​

number

height? ​

number

Returns ​

void


selectNode() ​

ts
selectNode(node, add?): void;

Defined in: packages/core/src/LGraphCanvas.ts:1596

selects a given node (or adds it to the current selection)

Parameters ​

node ​

LGraphNode

add? ​

boolean = false

Returns ​

void


selectNodes() ​

ts
selectNodes(nodes?, add?): void;

Defined in: packages/core/src/LGraphCanvas.ts:1605

selects several nodes (or adds them to the current selection)

Parameters ​

nodes? ​

LGraphNode[]

add? ​

boolean = false

Returns ​

void


sendToBack() ​

ts
sendToBack(this, node): void;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:36

sends a node to the back (below all other nodes)

Parameters ​

this ​

LGraphCanvas

node ​

LGraphNode

Returns ​

void

Inherited from ​

LGraphCanvas_Rendering.sendToBack


setCanvas() ​

ts
setCanvas(canvas, skipEvents?): void;

Defined in: packages/core/src/LGraphCanvas.ts:587

assigns a canvas

Parameters ​

canvas ​

string | HTMLCanvasElement

skipEvents? ​

boolean = false

Returns ​

void


setDirty() ​

ts
setDirty(fg?, bg?): void;

Defined in: packages/core/src/LGraphCanvas.ts:817

marks as dirty the canvas, this way it will be rendered again

Parameters ​

fg? ​

boolean = false

if the foreground canvas is dirty (the one containing the nodes)

bg? ​

boolean = false

if the background canvas is dirty (the one containing the wires)

Returns ​

void


setGraph() ​

ts
setGraph(graph, skipClear?): void;

Defined in: packages/core/src/LGraphCanvas.ts:480

assigns a graph, you can reassign graphs to the same canvas

Parameters ​

graph ​

LGraph | null

skipClear? ​

boolean = false

Returns ​

void


setZoom() ​

ts
setZoom(
   this, 
   value, 
   center
): void;

Defined in: packages/core/src/LGraphCanvas_Rendering.ts:15

changes the zoom level of the graph (default is 1), you can pass also a place used to pivot the zoom

Parameters ​

this ​

LGraphCanvas

value ​

number

center ​

Vector2

Returns ​

void

Inherited from ​

LGraphCanvas_Rendering.setZoom


showConnectionMenu() ​

ts
showConnectionMenu(this, opts?): boolean;

Defined in: packages/core/src/LGraphCanvas_UI.ts:1963

Parameters ​

this ​

LGraphCanvas

opts? ​
e? ​

MouseEventExt

nodeFrom? ​

LGraphNode

nodeTo? ​

LGraphNode

slotFrom? ​

| INodeSlot | SlotNameOrIndex

slotTo? ​

| INodeSlot | SlotNameOrIndex

Returns ​

boolean

Inherited from ​

LGraphCanvas_UI.showConnectionMenu


showEditPropertyValue() ​

ts
showEditPropertyValue(
   this, 
   node, 
   property, 
   options?
): IGraphDialog;

Defined in: packages/core/src/LGraphCanvas_UI.ts:2191

Parameters ​

this ​

LGraphCanvas

node ​

LGraphNode

property ​

any

options? ​

GraphDialogOptions = {}

Returns ​

IGraphDialog

Inherited from ​

LGraphCanvas_UI.showEditPropertyValue


showLinkMenu() ​

ts
showLinkMenu(
   this, 
   link, 
   e
): boolean;

Defined in: packages/core/src/LGraphCanvas_UI.ts:2176

Parameters ​

this ​

LGraphCanvas

LLink

e ​

any

Returns ​

boolean

Inherited from ​

LGraphCanvas_UI.showLinkMenu


showSearchBox() ​

ts
showSearchBox(
   this, 
   _event, 
   options?
): IGraphDialog;

Defined in: packages/core/src/LGraphCanvas_UI.ts:971

Parameters ​

this ​

LGraphCanvas

_event ​

MouseEvent

options? ​
do_type_filter? ​

boolean

hide_on_mouse_leave? ​

boolean

node_from? ​

LGraphNode

node_to? ​

LGraphNode

show_all_if_empty? ​

boolean

show_all_on_open? ​

boolean

show_general_after_typefiltered? ​

boolean

show_general_if_none_on_typefilter? ​

boolean

slotFrom? ​

| INodeSlot | SlotNameOrIndex

type_filter_in? ​

SlotType

type_filter_out? ​

SlotType

Returns ​

IGraphDialog

Inherited from ​

LGraphCanvas_UI.showSearchBox


showShowNodePanel() ​

ts
showShowNodePanel(this, node): void;

Defined in: packages/core/src/LGraphCanvas_UI.ts:1560

Parameters ​

this ​

LGraphCanvas

node ​

LGraphNode

Returns ​

void

Inherited from ​

LGraphCanvas_UI.showShowNodePanel


showSubgraphPropertiesDialog() ​

ts
showSubgraphPropertiesDialog(this, node): 
  | ISubgraphPropertiesPanel
  | undefined;

Defined in: packages/core/src/LGraphCanvas_UI.ts:1707

Parameters ​

this ​

LGraphCanvas

node ​

LGraphNode

Returns ​

| ISubgraphPropertiesPanel | undefined

Inherited from ​

LGraphCanvas_UI.showSubgraphPropertiesDialog


showSubgraphPropertiesDialogRight() ​

ts
showSubgraphPropertiesDialogRight(this, node): 
  | ISubgraphPropertiesPanel
  | undefined;

Defined in: packages/core/src/LGraphCanvas_UI.ts:1835

Parameters ​

this ​

LGraphCanvas

node ​

LGraphNode

Returns ​

| ISubgraphPropertiesPanel | undefined

Inherited from ​

LGraphCanvas_UI.showSubgraphPropertiesDialogRight


startRendering() ​

ts
startRendering(): void;

Defined in: packages/core/src/LGraphCanvas.ts:851

starts rendering the content of the canvas when needed

Returns ​

void


stopRendering() ​

ts
stopRendering(): void;

Defined in: packages/core/src/LGraphCanvas.ts:872

stops rendering the content of the canvas (to save resources)

Returns ​

void


switchLiveMode() ​

ts
switchLiveMode(transition?): void;

Defined in: packages/core/src/LGraphCanvas.ts:2024

switches to live mode (node shapes are not rendered, only the content) this feature was designed when graphs where meant to create user interfaces

Parameters ​

transition? ​

boolean

Returns ​

void


touchHandler() ​

ts
touchHandler(event): void;

Defined in: packages/core/src/LGraphCanvas.ts:2060

Parameters ​

event ​

TouchEvent

Returns ​

void


unbindEvents() ​

ts
unbindEvents(): void;

Defined in: packages/core/src/LGraphCanvas.ts:749

unbinds mouse events from the canvas

Returns ​

void


decodeHTML() ​

ts
static decodeHTML(str): string;

Defined in: packages/core/src/LGraphCanvas.ts:180

Parameters ​

str ​

string

Returns ​

string


getFileExtension() ​

ts
static getFileExtension(url): string;

Defined in: packages/core/src/LGraphCanvas.ts:168

Parameters ​

url ​

string

Returns ​

string


getPropertyPrintableValue() ​

ts
static getPropertyPrintableValue(value, values?): string;

Defined in: packages/core/src/LGraphCanvas.ts:186

Parameters ​

value ​

any

values? ​

any

Returns ​

string

Released under the MIT License.