Skip to content

@graphty/graphty-element / session / SessionPositions

Interface: SessionPositions ​

Defined in: graphty-element/src/session/types.ts:1707

Placing and pinning nodes, as undoable steps, beside the read-only coordinates.

Coordinates a running layout writes are not steps: where the layout comes to rest is recorded into the step before it, so undo and redo restore where the nodes were without running the layout again.

Extends ​

Properties ​

capacity ​

readonly capacity: number

Defined in: graphty-element/src/session/types.ts:1668

Rows the coordinates can hold without growing.

Inherited from ​

ReadonlyElementPositions.capacity


count ​

readonly count: number

Defined in: graphty-element/src/session/types.ts:1670

Rows in use: the node count of the current snapshot.

Inherited from ​

ReadonlyElementPositions.count


generation ​

readonly generation: number

Defined in: graphty-element/src/session/types.ts:1676

Moves whenever coordinates are written on purpose, so a reader can tell they changed.

Inherited from ​

ReadonlyElementPositions.generation


pinned ​

readonly pinned: ReadonlySet<NodeId>

Defined in: graphty-element/src/session/types.ts:1713

The pinned node ids: the nodes no layout moves. It holds and yields each id as the graph holds it, but has takes an integer id written either way, as SessionPositions.pin does: on a graph whose node 34 is pinned, pinned.has("34") is true.


pinnedCount ​

readonly pinnedCount: number

Defined in: graphty-element/src/session/types.ts:1674

Rows in use that are pinned.

Inherited from ​

ReadonlyElementPositions.pinnedCount


placedCount ​

readonly placedCount: number

Defined in: graphty-element/src/session/types.ts:1672

Rows in use that hold a coordinate.

Inherited from ​

ReadonlyElementPositions.placedCount

Methods ​

isPinned() ​

isPinned(index): boolean

Defined in: graphty-element/src/session/types.ts:1688

Whether a row is pinned.

Parameters ​

index ​

number

The dense node index.

Returns ​

boolean

False for an unpinned row or one past the rows in use.

Inherited from ​

ReadonlyElementPositions.isPinned


isPlaced() ​

isPlaced(index): boolean

Defined in: graphty-element/src/session/types.ts:1682

Whether a row holds a coordinate.

Parameters ​

index ​

number

The dense node index.

Returns ​

boolean

False for an unplaced row or one past the rows in use.

Inherited from ​

ReadonlyElementPositions.isPlaced


pin() ​

pin(ids): Promise<void>

Defined in: graphty-element/src/session/types.ts:1730

Pin nodes where they are. One step. An integer id may be written either way: "34" pins node 34.

Parameters ​

ids ​

readonly NodeId[]

The nodes.

Returns ​

Promise<void>

Settles once the step is recorded and the layout has taken the pins.

Throws ​

A GraphtyError (as a rejection) with E_BAD_COMMAND naming every id the graph does not hold, in details.ids; nothing is pinned then.


read() ​

read(index, out): void

Defined in: graphty-element/src/session/types.ts:1697

Read a row's coordinates into an object the caller owns.

Parameters ​

index ​

number

The dense node index.

out ​

Receives x, y and z in scene units; NaN for an unplaced row.

x ​

number

Receives x.

y ​

number

Receives y.

z ​

number

Receives z.

Returns ​

void

Inherited from ​

ReadonlyElementPositions.read


set() ​

set(entries): Promise<void>

Defined in: graphty-element/src/session/types.ts:1721

Place nodes. One step; calls made one after another within the coalescing window are one.

Parameters ​

entries ​

readonly PositionEntry[]

The nodes and where to put them.

Returns ​

Promise<void>

Settles once the step is recorded and the layout has taken the coordinates.

Throws ​

A GraphtyError (as a rejection) with E_BAD_COMMAND for a node the graph does not hold or a coordinate that is not a finite number; nothing is placed then.


unpin() ​

unpin(ids): Promise<void>

Defined in: graphty-element/src/session/types.ts:1739

Release pinned nodes, so the layout arranges them again. One step. Ids are looked up as SessionPositions.pin looks them up.

Parameters ​

ids ​

readonly NodeId[]

The nodes.

Returns ​

Promise<void>

Settles once the step is recorded and the layout has taken the change.

Throws ​

A GraphtyError (as a rejection) with E_BAD_COMMAND naming every id the graph does not hold, in details.ids; nothing is released then.