Home Reference Source
import {Artboard} from './api/Artboard.js'
public class | source

Artboard

Extends:

WrappedObjectLayerGroup → Artboard

A Sketch artboard.

Static Method Summary

Static Public Methods
public static

tests(): dictionary

Return a list of tests to run for this class.

Constructor Summary

Public Constructor
public

constructor(artboard: *, document: *)

Make a new artboard.

Member Summary

Public Members
public get

Is this an artboard?

Inherited Summary

From class WrappedObject
public static

tests(): dictionary

Return a list of tests to run for this class.

public get

id: string: *

Returns the object ID of the wrapped Sketch model object.

public get

Returns the wrapped Sketch object.

From class Layer
public static

tests(): dictionary

Return a list of tests to run for this class.

public get

Return the parent container of this layer.

public get

The frame of the layer.

public set

frame(frame: Rectangle): *

Set the frame of the layer.

public get

Return the index of this layer in it's container. The layer at the back of the container (visualy) will be layer 0. The layer at the front will be layer n - 1 (if there are n layers).

public get

Is this an artboard?

public get

isGroup: bool: boolean

Is this a group?

public get

isImage: bool: boolean

Is this an image layer?

public get

isPage: bool: boolean

Is this a page?

public get

isShape: bool: boolean

Is this a shape layer?

public get

isText: bool: boolean

Is this a text layer?

public get

name: string: *

The name of the layer.

public set

name(name: string): *

Set the name of the layer.

public

Add this layer to the selected layers.

public

Deselect this layer.

public

Duplicate this layer.

public

export(options: dictionary)

Export this layer (and the ones below it), using the options supplied.

public

Returns a list of export options with any missing ones replaced by default values.

public

Convert a rectangle in the coordinates that this layer uses to absolute (page) coordinates.

public

Convert a rectangle in the coordinates that this layer uses to it's parent's coordinates.

public

Move this layer backwards in its container.

public

Move this layer forward in its container.

public

Move this layer to the back of its container.

public

Move this layer to the front of its container.

public

remove()

Remove this layer from its parent.

public

select()

Select the layer.

From class Group
public static

tests(): dictionary

Return a list of tests to run for this class.

public get

isGroup: bool: boolean

Is this an group?

public

Adjust the group to fit its children.

public

iterate(block: function(layer: Layer))

Perform a function for every sub-layer inside this one.

public

iterateWithFilter(filter: function(layer: Layer), block: function(layer: Layer))

Perform a function for every sub-layer inside this one that passes a filter.

public

newGroup(properties: dictionary): Group

Returns a newly created group, which has been added to this layer, and sets it up using the supplied properties.

public

newImage(properties: dictionary): Image

Returns a newly created image layer, which has been added to this layer, and sets it up using the supplied properties.

public

newShape(properties: dictionary): Shape

Returns a newly created shape, which has been added to this layer, and sets it up using the supplied properties.

public

newText(properties: dictionary): Text

Returns a newly created text layer, which has been added to this layer, and sets it up using the supplied properties.

public

Convert a rectangle in page coordinates to one relative to this container's coordinates.

Static Public Methods

public static tests(): dictionary source

Return a list of tests to run for this class.

Override:

Group#tests

Return:

dictionary

A dictionary containing the tests to run. Each key is the name of a test, each value is a function which takes a Tester instance.

Public Constructors

public constructor(artboard: *, document: *) source

Make a new artboard.

Params:

NameTypeAttributeDescription
artboard *

{MSArtboardGroup} The underlying MSArtboardGroup model object from Sketch.

document *

The document that the artboard belongs to.

Public Members

public get isArtboard: *: boolean source

Is this an artboard?

All Layer objects respond to this method, but only Artboard objects return true.

Return:

*

true for instances of Artboard, false for any other layer type.

See something wrong or incomplete? Improve this page.