Skip to main content

BaseVertexComponent

Superclass for base node and base group components. You wont need to interact directly with this class; other component base classed in VisuallyJs extend from it.

Extended by​

Type Parameters​

T​

T extends Node

Implements​

  • OnInit
  • OnDestroy

Methods​

addNewPort()​

addNewPort(type, data): void

Instructs the model to add a new port with the given data to the vertex this component represents. This will call the model's portFactory.

Parameters​

type​

string

data​

ObjectData

Returns​

void

Class Member​


addPort()​

addPort(data): Port

Adds a port with the given data to the vertex this component represents.

Parameters​

data​

ObjectData

Returns​

Port

Class Member​


addToSelection()​

addToSelection(): void

Adds the vertex this component represents to the current selection in the model.

Returns​

void

Class Member​


cloneVertex()​

cloneVertex(options?): void

Clones this vertex, optionally setting to a given position, or offsetting from the original, and optionally magnetizing the new vertex's position, and flashing it to show the user where it is.

Parameters​

options?​

SurfaceVertexCloneOptions

Returns​

void

Class Member​


flashVertex()​

flashVertex(duration, animName?): void

Flash this vertex

Parameters​

duration​

number

Optional; defaults to 1000ms. Duration of the animation in milliseconds.

animName?​

string

Optional; the name of the CSS animation to apply. Defaults to ANIM_SURFACE_ELEMENT_FLASH.

Returns​

void


getVertex()​

getVertex(): T

Gets the vertex that this component represents. Subclasses have getters that return more specific subclasses of Vertex.

Returns​

T

Class Member​


removeFromSelection()​

removeFromSelection(): void

Removes the vertex this component represents from the current selection in the model.

Returns​

void

Class Member​


removeVertex()​

removeVertex(): void

Removes the vertex this component represents from the data model, which will cause this component to be cleaned up.

Returns​

void

Class Member​


setAsSelection()​

setAsSelection(): void

Sets the vertex this component represents as the current selection in the model.

Returns​

void

Class Member​


updateVertex()​

updateVertex(data): void

Shortcut method to update the current data backing this vertex, for convenience.

Parameters​

data​

ObjectData

Returns​

void

Class Member​

Properties​

$data​

readonly $data: WritableSignal<ObjectData>

This signal represents the underlying data for the vertex this component represents.

Class Member​


allSourceEdges​

allSourceEdges: WritableSignal<Edge[]>

This signal provides all of the edges for which this vertex or one of its ports is the source.


allTargetEdges​

allTargetEdges: WritableSignal<Edge[]>

This signal provides all of the edges for which this vertex or one of its ports is the target.


data​

data: ObjectData

Data object for the vertex

Class Member​


sourceEdges​

sourceEdges: WritableSignal<Edge[]>

This signal provides all of the edges for which this vertex is the source. These are edges connected to the vertex, not to its ports.


targetEdges​

targetEdges: WritableSignal<Edge[]>

This signal provides all of the edges for which this vertex is the target. These are edges connected to the vertex, not to its ports.


zoom​

zoom: WritableSignal<number>

This is a signal that provides the current zoom for the canvas the component is in. You can use this to selectively hide/show content based upon the zoom level.

Class Member​