Layer

Vecta.Layer

new Vecta.Layer([id])

Creates a new layer or gets existing layer.

NameTypeAttributesDescription
idstringoptional

Null or undefined to create a new layer, otherwise a valid ID string to get the layer

Examples:
var layer = new Vecta.Layer(); //creates a new layer called 'Untitled Layer'

Methods

.delete(keep)

Deletes the layer.

NameTypeDescription
keepboolean

True to move all shapes to the default layer, false to remove all shapes.

.hidden([state]) Returns: Vecta.Layer

Get or set visibility of the layer.

NameTypeAttributesDescription
statebooleanoptional

Undefined to get current visibility, true to set hidden and false to set to visible.

.name([name]) Returns: string|Vecta.Layer

Get or set layer name.

NameTypeAttributesDescription
namestringoptional

Undefined to get the layer name, a string to set

Returns:

Returns the name when get or Vecta.Layer object when set.

.print([state]) Returns: Vecta.Layer

Get or set layer to be included in export and/or print.

NameTypeAttributesDescription
statebooleanoptional

Undefined to get, true to include in export and/or print, false to exclude.

.select() Returns: Vecta.Layer

Select all shapes in the layer.

Examples:
var layer = new Vecta.Layer('#my_layer');

layer.select();
console.log(Vecta.selection.shapes()); //outputs all shapes in layer