Class

InputSocketComponent

InputSocketComponent(x, y, width, height, scale, type, node, label, userInput)

The object for ingoing plug connections. On nodes

Constructor

# new InputSocketComponent(x, y, width, height, scale, type, node, label, userInput)

Initiates a new inputSocketComponent

Parameters:
Name Type Default Description
x Number

x position in the parent svg

y Number

y position in the parent svg

width Number

the width of he inputsocket

height Number

the height

scale Number

the scale, set to 1 to ignore

type String

type of the socket, see InputSocketComponent.Type for types

node Node

parent node object, the socket is attached to

label String

the label of the socket

userInput Boolean true

Wether or not to include some kind of input component for the user to enter a value

View Source index.js, line 963

Extends

Members

# Type

Valid types used for InputSocketComponents

View Source index.js, line 969

Methods

# connect(connector) → {void}

Callback function for Connectors. This function gets called as soon as a connector connects.

Parameters:
Name Type Description
connector Connector

The connector that connected

View Source index.js, line 1095

void

# createSVGElement(c) → {HTMLElement}

Puts together the HTML element with all it's sub element, ready to be added to a parent.

Parameters:
Name Type Default Description
c HTMLElement null

(Optional) Equivalent to setting the .renderContainer property.

Overrides:

View Source index.js, line 162

Returns the HTML element, containing all the children.

HTMLElement

# disconnect(connector) → {void}

Callback function for Connectors. This function gets called as soon as a connector disconnects.

Parameters:
Name Type Description
connector Connector

The connector that disconnected

View Source index.js, line 1113

void

# hide() → {void}

Makes the component invisible. Interactions shouldn't be possible anymore.

Overrides:

View Source index.js, line 51

void

# move(deltaX, deltaY) → {Position}

Move the component relative to its current position.

Parameters:
Name Type Description
deltaX number

The amount of

deltaY number

description

Overrides:

View Source index.js, line 192

The new position

Position

# moveToTop() → {boolean}

Moves the svg container to the top of the parent. The parent has to be specified earlier by setting .renderContainer to an HTML element

Overrides:

View Source index.js, line 127

Wether moving could be done or not. Returns false, if renderContainer isn't set.

boolean

# onValueChange(cb) → {void}

Add a listener to the onValueChange event

Parameters:
Name Type Description
cb function

The callback. The passed parameter contains a .prevent() method that cancel the event like the .preventDefault method

View Source index.js, line 1085

void

# setComponentScale(newScale) → {number}

Scales the component and its children.

Parameters:
Name Type Description
newScale number

The new scale of the component

Overrides:
Deprecated:
  • Broken in many ways, use .setViewboxScale() instead.

View Source index.js, line 207

The new scale.

number

# setConnectionCallback(cb) → {void}

Specify the function to execute when a connector gets attached.

Parameters:
Name Type Description
cb function

The callback. The function receives the connector that has been connected as argument.

View Source index.js, line 1066

void

# setDisconnectionCallback(cb) → {void}

Specify the function to execute when a connector gets detached.

Parameters:
Name Type Description
cb function

The callback. The function receives the connector that has been deconnected as argument.

View Source index.js, line 1075

void

# setPosition(pos) → {object}

Change the coordinates in the parent svg element

Parameters:
Name Type Description
pos object

The new position object

x number

X coordinate

y number

Y coordinate

Overrides:

View Source index.js, line 149

The new position

object

# setType(type) → {void}

Changes the data type of this socket after initialization.

Parameters:
Name Type Description
type InputSocketComponentType

The new data type.

View Source index.js, line 1203

void

# setViewboxScale(newScale) → {void}

Change the scale of the element using the viewBox property.

Parameters:
Name Type Description
newScale number

The new scale of the element

Overrides:

View Source index.js, line 232

void

# show() → {void}

Reverts hide

Overrides:

View Source index.js, line 59

void

# updateAttributes() → {void}

Updates the attributes of the SVG element in the DOM

Overrides:

View Source index.js, line 68

Void

void