Skip to content

@graphty/graphty-element / extend / LayoutContext

Interface: LayoutContext<V> ​

Defined in: graphty-element/src/simple/types.ts:316

What a layout's place receives beside the graph.

Type Parameters ​

V ​

V

Properties ​

dimensions ​

readonly dimensions: 2 | 3

Defined in: graphty-element/src/simple/types.ts:320

The view's dimensions. In 2D the element drops any z returned.


options ​

readonly options: V

Defined in: graphty-element/src/simple/types.ts:318

The option values, checked and with their defaults filled in.


signal ​

readonly signal: AbortSignal

Defined in: graphty-element/src/simple/types.ts:326

Aborted when a newer layout replaces this one.

Methods ​

fixed() ​

fixed(id): Point | null

Defined in: graphty-element/src/simple/types.ts:322

Where a pinned or held node is, or null for a node the layout may place.

Parameters ​

id ​

NodeId

Returns ​

Point | null


progress() ​

progress(fraction): Promise<void>

Defined in: graphty-element/src/simple/types.ts:328

As AlgorithmContext.progress: await it inside a loop to keep the page responsive.

Parameters ​

fraction ​

number

Returns ​

Promise<void>


random() ​

random(): number

Defined in: graphty-element/src/simple/types.ts:324

Seeded random numbers in [0, 1). Deterministic unless the definition sets random: true.

Returns ​

number