@add-on-hlapi-sdk / LineNode
Class: LineNode
A LineNode represents a simple line object in the scenegraph – a single straight-line segment.
Hierarchy
↳
LineNode
Table of contents
Properties
Accessors
- absoluteRotation
- absoluteTransform
- allChildren
- blendMode
- endArrowHeadType
- endX
- endY
- locked
- opacity
- parent
- relativeRotation
- relativeTransform
- startArrowHeadType
- startX
- startY
- strokes
- translateX
- translateY
- type
Methods
Properties
DEFAULT_END_X
▪ Static Readonly DEFAULT_END_X: 100
DEFAULT_END_Y
▪ Static Readonly DEFAULT_END_Y: 100
DEFAULT_START_X
▪ Static Readonly DEFAULT_START_X: 0
DEFAULT_START_Y
▪ Static Readonly DEFAULT_START_Y: 0
DEFAULT_STROKE_WIDTH
▪ Static DEFAULT_STROKE_WIDTH: number = 20
Inherited from
StrokableNode.DEFAULT_STROKE_WIDTH
Accessors
absoluteRotation
• get absoluteRotation(): number
The node's absolute (global) rotation angle in degrees – includes any cumulative rotation from the node's parent containers.
Returns
number
Inherited from
StrokableNode.absoluteRotation
• set absoluteRotation(value): void
Parameters
| Name | Type |
|---|---|
value | number |
Returns
void
Inherited from
StrokableNode.absoluteRotation
absoluteTransform
• get absoluteTransform(): mat2d
The node's absolute (global) transform matrix.
Returns
Inherited from
StrokableNode.absoluteTransform
allChildren
• get allChildren(): Readonly<Iterable<Node>>
Returns a read-only list of all children of the node. General-purpose content containers such as ArtboardNode or
GroupNode also provide a mutable children list. Other nodes with a more specific structure can
hold children in various discrete "slots"; this allChildren list includes all such children and reflects their
overall display z-order.
Returns
Readonly<Iterable<Node>>
Inherited from
StrokableNode.allChildren
blendMode
• get blendMode(): BlendModeValue
Blend mode determines how a node is composited onto the content below it. The default value is normal for most nodes, and passThrough for GroupNodes.
Returns
Inherited from
StrokableNode.blendMode
• set blendMode(value): void
Parameters
| Name | Type |
|---|---|
value |
Returns
void
Inherited from
StrokableNode.blendMode
endArrowHeadType
• get endArrowHeadType(): ArrowHeadType
The shape encapsulating the end of a line. The size and color of the arrowhead depends on the first available stroke's weight and color assigned to the node. Removal of all strokes on this line leads to the arrowhead's removal.
The getter returns none when there are no strokes on the line or no arrowhead on the first stroke of the line.
Returns
• set endArrowHeadType(type): void
The setter creates a default stroke for the line when there are no strokes on the line, and updates the arrowhead on only the first stroke of the line.
Parameters
| Name | Type |
|---|---|
type |
Returns
void
endX
• get endX(): number
The end point on the x-axis in the parent's coordinate system. Modify using setEndPoints().
Returns
number
endY
• get endY(): number
The end point on the y-axis in the parent's coordinate system. Modify using setEndPoints().
Returns
number
locked
• get locked(): boolean
The node's lock/unlock state. Locked nodes are excluded from the selection (see selection), and cannot be edited by the user unless they are unlocked first.
Returns
boolean
Inherited from
StrokableNode.locked
• set locked(locked): void
Parameters
| Name | Type |
|---|---|
locked | boolean |
Returns
void
Inherited from
StrokableNode.locked
opacity
• get opacity(): number
The node's opacity, from 0.0 to 1.0
Returns
number
Inherited from
StrokableNode.opacity
• set opacity(opacity): void
Parameters
| Name | Type |
|---|---|
opacity | number |
Returns
void
Inherited from
StrokableNode.opacity
parent
• get parent(): undefined | Node
The node's parent. Undefined if the node is an orphan, or if the node is the artwork root.
Returns
undefined | Node
Inherited from
StrokableNode.parent
relativeRotation
• get relativeRotation(): number
The node's local rotation value in degrees, relative to its parent's axes. Modifying this value will also adjust the node's x & y translation such that the node's center is in the same location after the rotation – i.e. this setter rotates the node about its bounding box's center, not its origin.
Returns
number
Inherited from
StrokableNode.relativeRotation
• set relativeRotation(value): void
Parameters
| Name | Type |
|---|---|
value | number |
Returns
void
Inherited from
StrokableNode.relativeRotation
relativeTransform
• get relativeTransform(): mat2d
The node's transform matrix relative to its parent.
Returns
Inherited from
StrokableNode.relativeTransform
startArrowHeadType
• get startArrowHeadType(): ArrowHeadType
The shape encapsulating the start of a line. The size and color of the arrowhead depends on the first available stroke's weight and color assigned to the node. Removal of all strokes on this line leads to the arrowhead's removal.
The getter returns none when there are no strokes on the line or no arrowhead on the first stroke of the line.
Returns
• set startArrowHeadType(type): void
The setter creates a default stroke for the line when there are no strokes on the line, and updates the arrowhead on only the first stroke of the line.
Parameters
| Name | Type |
|---|---|
type |
Returns
void
startX
• get startX(): number
The start point on the x-axis in the parent's coordinate system. Modify using setEndPoints().
Returns
number
startY
• get startY(): number
The start point on the y-axis in the parent's coordinate system. Modify using setEndPoints().
Returns
number
strokes
• get strokes(): ItemList<Stroke>
Any stroke(s) on the shape. Use the methods on this ItemList object to get, add, and remove strokes.
Returns
Inherited from
StrokableNode.strokes
translateX
• get translateX(): number
The translation of the node along its parent's x-axis.
Returns
number
Inherited from
StrokableNode.translateX
• set translateX(value): void
Parameters
| Name | Type |
|---|---|
value | number |
Returns
void
Inherited from
StrokableNode.translateX
translateY
• get translateY(): number
The translation of the node along its parent's y-axis.
Returns
number
Inherited from
StrokableNode.translateY
• set translateY(value): void
Parameters
| Name | Type |
|---|---|
value | number |
Returns
void
Inherited from
StrokableNode.translateY
type
• get type(): SceneNodeTypeValueID
The node's type.
Returns
Inherited from
StrokableNode.type
Methods
removeFromParent
▸ removeFromParent(): void
Removes the node from its parent - for a basic ContainerNode, this is equivalent to node.parent.children.remove(node).
For nodes with other slots, removes the child from whichever slot it resides in, if possible. Throws if the slot does
not support removal. Also throws if node is the artwork root. No-op if node is already an orphan.
Returns
void
Inherited from
StrokableNode.removeFromParent
setEndPoints
▸ setEndPoints(startX, startY, endX, endY): void
Set the start and end points of the line in its local coordinate space (which may
differ from its parent's coordinate space based on relativeTransform, i.e.
relativeRotation and translateX/Y). The values passed in may be normalized
by this setter, shifting the node's translation and counter-shifting the start/end
points. Therefore, the start/end getters may return values different from the values
you passed into this setter, even though the line's visual bounds and appearance are
the same. Rotation is preserved.
Parameters
| Name | Type |
|---|---|
startX | number |
startY | number |
endX | number |
endY | number |
Returns
void

