# 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 |
Extends
Members
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 |
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:
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 |
void
# hide() → {void}
Makes the component invisible. Interactions shouldn't be possible anymore.
- Overrides:
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:
The new 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:
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 |
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.
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. |
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. |
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:
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. |
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:
void
# updateAttributes() → {void}
Updates the attributes of the SVG element in the DOM
- Overrides:
Void
void