Skip to content

@gausszhou/litegraph-core / LGraphCanvas_Rendering

Class: LGraphCanvas_Rendering ​

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

Extended by ​

Constructors ​

Constructor ​

ts
new LGraphCanvas_Rendering(): LGraphCanvas_Rendering;

Returns ​

LGraphCanvas_Rendering

Methods ​

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


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


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[]


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


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


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


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


drawExecutionOrder() ​

ts
drawExecutionOrder(this, ctx): void;

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

Parameters ​

this ​

LGraphCanvas

ctx ​

CanvasRenderingContext2D

Returns ​

void


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


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


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


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


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


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


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


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


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


onRender()? ​

ts
onRender?(canvas, ctx): void;

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

Parameters ​

canvas ​

HTMLCanvasElement

ctx ​

CanvasRenderingContext2D

Returns ​

void


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


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


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


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

Released under the MIT License.