Skip to content

@phun-ky/arclace / Connection

Class: Connection ​

Defined in: src/Connection.ts:97

A line between two elements. Created with Arclace.connect or Arclace.connectAll, not with new.

Each connection renders as:

html
<g class="arc-connection arc-bezier">
  <marker class="arc-marker">…</marker>  <!-- when `arrow` is set -->
  <path class="arc-path" />
  <text class="arc-label">…</text>       <!-- when `label` is set -->
  <circle class="arc-anchor arc-anchor-start" />  <!-- when `anchors` is set -->
  <circle class="arc-anchor arc-anchor-end" />
</g>

The line, arrows and anchors use currentColor, so setting color on .arc-connection colors all of them.

Properties ​

element ​

readonly element: SVGGElement

Defined in: src/Connection.ts:105

The <g> element holding everything this connection draws.


endElement ​

readonly endElement: Element

Defined in: src/Connection.ts:100


id ​

readonly id: string

Defined in: src/Connection.ts:98


path ​

readonly path: SVGPathElement

Defined in: src/Connection.ts:110

The <path> element of the line.


startElement ​

readonly startElement: Element

Defined in: src/Connection.ts:99

Accessors ​

geometry ​

Get Signature ​

get geometry(): Readonly<ArcGeometryType> | null

Defined in: src/Connection.ts:160

The geometry from the last update, or null when the connection is hidden because one of its elements is not rendered.

Returns ​

Readonly<ArcGeometryType> | null


options ​

Get Signature ​

get options(): Readonly<ArcResolvedConnectionOptionsType>

Defined in: src/Connection.ts:167

The connection's options merged with the instance defaults.

Returns ​

Readonly<ArcResolvedConnectionOptionsType>

Methods ​

remove() ​

remove(): void

Defined in: src/Connection.ts:215

Removes this connection.

Returns ​

void


setOptions() ​

setOptions(options): this

Defined in: src/Connection.ts:187

Changes options and redraws.

Parameters ​

options ​

Omit<ArcConnectionOptionsType, "id">

Returns ​

this

Example ​

ts
connection.setOptions({ type: 'orthogonal', arrow: 'end' });

Throws ​

When an option has the wrong type, or id is set.

Throws ​

When an option is out of range.

Throws ​

When the connection has been removed.


update() ​

update(): void

Defined in: src/Connection.ts:208

Redraws every connection of the owning instance.

Returns ​

void

Released under the MIT License.