Skip to content

GraphNode

Unofficial

Represents a node in the graph view.

Import:

import type { GraphNode } from '@obsidian-typings/obsidian-catalyst-latest';

Signature:

export interface GraphNode

Properties

Property Type Description
circle Graphics | null PixiJS element for the circle, child of GraphRenderer.hanger.
color GraphColorAttributes Computed color for the node.
fadeAlpha number Current fade alpha value controlling the node's transparency during transitions.
fontDirty boolean Indicates if the text needs to be re-rendered when the node is rendered.
forward Record<string, GraphLink> Record of forward links. Keys are the id of the neighbor nodes.
fx null | number Forced x position when the node is dragged.
fy null | number Forced y position when the node is dragged.
highlight Graphics | null Colored circle added if the node is highlighted, child of GraphNode.circle.
id string ID of the node (path, tag, or name for non-existing files).
moveText number Displacement of the text, changed when the node is hovered
rendered boolean Whether the node graphics have been rendered.
renderer GraphRenderer GraphRenderer managing this node
reverse Record<string, GraphLink> Record of backward links. Keys are the id of the neighbor nodes.
text null | PIXIText PixiJS element for the name, child of GraphNode.circle.
type string Type of the node, can be of value "tag", "unresolved", "attachment", or an empty string for markdown nodes.
weight number Weight of the node depending on the number of related nodes (forwards and backward).
x number X-axis position of the node in the graph
y number Y-axis position of the node in the graph

Methods

Method Returns Description
clearGraphics() void Destroy the graphics and its children, and remove them from the scene.
getDisplayText() string Get the displayed text associated to the node.
getFillColor() GraphColorAttributes Get the current fill color.
getRelated() string[] Get the ids of connected nodes (back and forward links).
getSize() number Get the current size of the node, after weight and node size multiplier have been applied.
getTextStyle() TextStyle Get the text style of the node.
initGraphics() void Initialize the node, text, listeners, and add them to the scene.
onClick(e) void Method called when the node (circle) is clicked, trigger the context menu if it's a right click
render() void Render the node.

Links to this page: