# new Node(x, y, scale, svgEngine) → {Node}
Initiates a new Node object
Parameters:
Name | Type | Description |
---|---|---|
x |
number
|
The x position in the current viewport or container. |
y |
number
|
The y position in the current viewport or container. |
scale |
number
|
The scale of the Node. |
svgEngine |
object
|
The SVGEngine object, the node is added to. |
The new Node object.
Extends
Members
Methods
# addAttachment(at) → {void}
Attach an attachment to the node object.
Parameters:
Name | Type | Description |
---|---|---|
at |
Attachment
|
The attachment that should be attached. |
void
# addEventListener(event, cb) → {object}
Add an event listener to the node.
Parameters:
Name | Type | Description |
---|---|---|
event |
"move"
|
The event that should be listened for. |
cb |
Node~EventCallback
|
The callback function. |
The event listener.
object
# addInputSocket(type, label) → {InputSocketComponent}
Adds an InputSocket. These sockets can be used for data transfer. They are also typed and there are strict rules for which connector type can connect to which socket type.
Parameters:
Name | Type | Description |
---|---|---|
type |
InputSocketComponentType
|
The type of the socket. |
label |
string
|
A label for the socket that will be displayed right to it. |
The initiated input socket.
# addOutputPlug(type, label, style) → {OutputPlugComponent}
Adds an OutputPlug to the node. These are used to create data connectors.
Parameters:
Name | Type | Description |
---|---|---|
type |
OutputPlugComponentType
|
The type of the plug |
label |
string
|
The label of the plug that will be displayed left to it. |
style |
"bezier"
|
"line"
|
The style of the connector. |
- See:
-
- See Node#addInputSocket for more details on data connections.
The initiated plug object
# addPlug(label, style) → {array}
Add a flow plug. Flow plugs can be used to create flow connections to flow sockets.
Parameters:
Name | Type | Description |
---|---|---|
label |
string
|
A label that will be displayed left to the plug. |
style |
"bezier"
|
"line"
|
The style of the connector starting from this plug. |
- See:
-
- See Node#addSocket for more info about the program flow.
Returns an array of all the attached plugs.
array
# addSocket() → {array}
Add a new program flow socket. Flow sockets/plugs are used to tell ULVS which nodes run when. The flow starts at a start node and then follows all connected flow connectors from node to node, resulting in a program order.
An array containing all of the current flow sockets.
array
# addUserInput(type, label) → {object}
Add a user input to the body of the node. The user can enter values that will be used in the compiling process as constants. Temporary deprecated
Parameters:
Name | Type | Default | Description |
---|---|---|---|
type |
InputSocketComponentType
|
The data type of the input. |
|
label |
string
|
"" | The label of thé input that will be displayed next to it. |
- Deprecated:
- Temporary deprecated as user inputs are included in input sockets
The input object depending on the data type.
object
# 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
# 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
# removeEventListener(event, listener, …opts) → {void}
Remove a given listener from the node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
event |
string
|
"move"
|
The event of the listener that should be removed |
|
listener |
object
|
The listener (returned by Node#addEventListener) |
|
opts |
object
|
<repeatable> |
Other options you might want to pass to the eventTarget; see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener#parameters |
void
# setClass(c) → {void}
Change the class after initialization.
Parameters:
Name | Type | Description |
---|---|---|
c |
NodeClass
|
The new class |
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
# setId(id) → {void}
Set the nodeIdentifier of this node. This id will be provided in the program spec on program generation for the compiler.
Parameters:
Name | Type | Description |
---|---|---|
id |
string
|
The new id of the Node. |
void
# setName(name) → {Text#setText}
Change the name of the node after initialization.
Parameters:
Name | Type | Description |
---|---|---|
name |
string
|
The new name |
# 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
# 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
Type Definitions
# EventCallback(event)
Parameters:
Name | Type | Description |
---|---|---|
event |
object
|
The event object. |
detail |
object
|
The data that is delivered if it is a custom event, like the "move" event. |
- See:
-
- https://developer.mozilla.org/en-US/docs/Web/API/Event for further information about the events structure. In case of a custom event like "move" see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent