@express-document-sdk

Class: ArtboardNode

An ArtboardNode represents the topmost container of visual content within a PageNode. When a page contains multiple artboards, each represents a keyframe "scene" in the page's animation timeline.

To create a new artboard, see ArtboardList.addArtboard.

Extends

Implements

Constructors

Constructor

new ArtboardNode(): ArtboardNode;

Returns

ArtboardNode

Inherited from

VisualNode.constructor

Accessors

allChildren

Get Signature

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 ContainerNode.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.

The children of an Artboard are all subclasses of Node (not just the more minimal BaseNode or VisualNode).

Returns

Readonly<Iterable<Node>>

Implementation of

ContainerNode.allChildren

Overrides

VisualNode.allChildren

allDescendants

Get Signature

get allDescendants(): Readonly<Iterable<Node>>;

Experimental

data-slots=text
data-variant=warning
IMPORTANT: This is currently experimental only and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the experimentalApis flag to true in the requirements section of the manifest.json.

Helper to recursively traverse all the exposed scenegraph content within the subtree of this node. Every container node and every leaf node will be visited via a pre-order tree traversal. Although once called the list of direct descendants is static, changes to further descendants may appear while iterating depending on when the operation occurs relative to the parent being yielded. Note that the root node (i.e. what this API was called on) is not visited.

The descendants of an Artboard are all subclasses of Node (not just the more minimal BaseNode or VisualNode).

Warning: Processing text content via this API can be error-prone. Use VisualNode.allTextContent

Returns

Readonly<Iterable<Node>>

Implementation of

ContainerNode.allDescendants

Overrides

VisualNode.allDescendants

children

Get Signature

get children(): ItemList<Node>;

The artboards's regular children (does not include any "background layer" content if present; use allChildren for a read-only view that includes background content). Use the methods on this children ItemList object to get, add, and remove regular children.

Returns

ItemList<Node>

Implementation of

ContainerNode.children

fill

Get Signature

get fill(): Readonly<Fill>;
Returns

Readonly<Fill>

Set Signature

set fill(fill): void;

The background fill of the artboard. Artboards must always have a fill.

Parameters
Parameter
Type
fill
Fill
Returns

void

parent

Get Signature

get parent(): PageNode | undefined;

The node's parent. Undefined if the node is an orphan.

Returns

PageNode | undefined

Implementation of

ContainerNode.parent

Overrides

VisualNode.parent

width

Get Signature

get width(): number;

The width of the artboard. Shares the same dimensions as the parent PageNode and other artboards within the parent PageNode. To resize an artboard, resize the parent PageNode.

Returns

number

Implementation of

IRectangularNode.width

height

Get Signature

get height(): number;

The height of the artboard. Shares the same dimensions as the parent PageNode and other artboards within the parent PageNode. To resize an artboard, resize the parent PageNode.

Returns

number

Implementation of

IRectangularNode.height

addOnData

Get Signature

get addOnData(): AddOnData;

Get AddOnData reference for managing the private metadata on this node for this add-on.

Returns

AddOnData

Implementation of

ContainerNode.addOnData

Inherited from

VisualNode.addOnData

id

Get Signature

get id(): string;

A unique identifier for this node that stays the same when the file is closed & reopened, or if the node is moved to a different part of the document.

Returns

string

Implementation of

ContainerNode.id

Inherited from

VisualNode.id

type

Get Signature

get type(): SceneNodeType;

The node's type.

Returns

SceneNodeType

Implementation of

ContainerNode.type

Inherited from

VisualNode.type

visualRoot

Get Signature

get visualRoot(): VisualNode;

The highest ancestor that still has visual presence in the document. Typically an Artboard, but for orphaned content, it will be the root of the deleted content (which might be this node itself).

Nodes that are both in the same visualRoot subtree lie within the same "visual space" of the document's structure. Nodes that are in different visual roots have no spatial relation to one another; there is no meaningful comparison or conversion between the bounds or coordinate spaces of such nodes.

Returns

VisualNode

Implementation of

ContainerNode.visualRoot

Inherited from

VisualNode.visualRoot

allTextContent

Get Signature

get allTextContent(): Readonly<Iterable<TextContent>>;

Experimental

data-slots=text
data-variant=warning
IMPORTANT: This is currently experimental only and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the experimentalApis flag to true in the requirements section of the manifest.json.

Helper to process all text content that is found as part of or within this node. This can be hard to do correctly via manual tree traversal since multiple ThreadedTextNode can share a single TextContentModel.

This iterator returns a single result per TextContentModel that is at least partially displayed within this node, even if that content is split across several separate TextNode "frames". If this node is or contains some but not all of the display frames of an overall TextContentModel, that model is still included as a result.

Note that visibleRanges and visibleText may not be sorted as TextNode "frames" can appear in any order in the scenegraph.

Returns

Readonly<Iterable<TextContent>>

Implementation of

ContainerNode.allTextContent

Inherited from

VisualNode.allTextContent

boundsLocal

Get Signature

get boundsLocal(): Readonly<Rect>;

The bounding box of the node, expressed in the node's local coordinate space (which may be shifted or rotated relative to its parent). Generally matches the selection outline seen in the UI, encompassing the vector path "spine" of the shape as well as its stroke, but excluding effects such as shadows.

The top-left corner of the bounding box corresponds to the visual top-left corner of the node, but this value is not necessarily (0,0) – this is especially true for Text and Path nodes.

Returns

Readonly<Rect>

Implementation of

ContainerNode.boundsLocal

Inherited from

VisualNode.boundsLocal

centerPointLocal

Get Signature

get centerPointLocal(): Readonly<Point>;

Position of the node's centerpoint in its own local coordinate space, i.e. the center of the boundsLocal box.

Returns

Readonly<Point>

Implementation of

ContainerNode.centerPointLocal

Inherited from

VisualNode.centerPointLocal

topLeftLocal

Get Signature

get topLeftLocal(): Readonly<Point>;

Position of the node's top-left corner in its own local coordinate space, equal to (boundsLocal.x, boundsLocal.y). If the node is rotated, this is not the same as the top-left corner of boundsInParent.

Returns

Readonly<Point>

Implementation of

ContainerNode.topLeftLocal

Inherited from

VisualNode.topLeftLocal

Methods

removeFromParent()

removeFromParent(): void;

Removes the node from its parent - effectively deleting it, if the node is not re-added to another parent before the document is closed.

If parent is a basic ContainerNode, this is equivalent to node.parent.children.remove(node). For nodes with other child "slots," removes the child from whichever slot it resides in, if possible. Throws if the slot does not permit removal. No-op if node is already an orphan.

Returns

void

Implementation of

ContainerNode.removeFromParent

Inherited from

VisualNode.removeFromParent

localPointInNode()

localPointInNode(localPoint, targetNode): Readonly<Point>;

Convert a point given in the node’s local coordinate space to a point in the coordinate space of the target node. Both nodes must share the same visualRoot, but can lie anywhere within that subtree relative to one another (the target node need not be an ancestor of this node, nor vice versa).

Parameters

Parameter
Type
localPoint
Point
targetNode
VisualNode

Returns

Readonly<Point>

Implementation of

ContainerNode.localPointInNode

Inherited from

VisualNode.localPointInNode

createRendition()

createRendition(options?): Promise<CreateRenditionResult>;

Experimental

data-slots=text
data-variant=warning
IMPORTANT: This is currently experimental only and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the experimentalApis flag to true in the requirements section of the manifest.json.

Generates a rendition of this node and its descendants.

If this node contains images, it will wait for the best quality to be available before capturing. As such, there is a 20s timeout before an error is thrown to prevent indefinite waiting.

Parameters

Parameter
Type
options?
CreateRenditionOptions

Returns

Promise<CreateRenditionResult>

Implementation of

ContainerNode.createRendition

Inherited from

VisualNode.createRendition