Stencil

Vecta.Stencil

new Vecta.Stencil(node)

Vecta stencil object. Wraps a currently open stencil.

NameTypeDescription
nodestring|Element

The stencil itself. Can be the stencil's ID, node or JQuery object.

See also:

Properties

.$jQuery

The jQuery wrapped node for the stencil.

NameTypeDescription
$jQuery

jQuery wrapper for stencil node.

Methods

.addSymbol(shape, [index]) Returns: Vecta.Symbol

Create a symbol from a given shape and adds it into the stencil.

NameTypeAttributesDescription
shapeVecta.Shape

A Vecta.Shape to be added to the stencil.

indexnumberoptional

Indexes are zero-based. If not defined, shape is automatically added to the bottom of the stencil.

Returns:

The symbol being added.

.category([category]) Returns: array|Vecta.Stencil

Get or set stencil category.

NameTypeAttributesDescription
categorystringoptional

Undefined to get, valid category string to set.

To set multiple categories, pass in a string of categories separated with commas, eg: "Google, Amazon, Vecta".

Returns:

Returns the categories when get or Vecta.Stencil when set.

.close() Returns: Vecta.Stencil

Close a stencil in the editor.

Note that the stencil is closed and not deleted and still available to be reopened.

.credits([cred]) Returns: object|Vecta.Stencil

Get or set stencil credits.

User must have access to the stencil to write, with the exception for saved search stencil, which is read only.

NameTypeAttributesDescription
credobjectoptional

Undefined to get, valid credits object to set.

NameTypeAttributesDescription
namestringoptional

Name of the credits to be displayed

linkstringoptional

URL link of the credits

Returns:

Returns the credits if get, or Vecta.Stencil for chaining.

.delete() Returns: Vecta.Stencil

Deletes the stencil.

.desc([desc]) Returns: string|Vecta.Stencil

Get or set stencil description.

NameTypeAttributesDescription
descstringoptional

Undefined to get, valid descriptions string to set.

Returns:

Returns the description when get, or Vecta.Stencil when get.

.id() Returns: string

Returns the stencil's id. Read only.

Examples:
var stencil = new Vecta.Stencil('stencil_1');

console.log(stencil.id()); //"stencil_1"

.locked() Returns: boolean

Determines if the stencil is locked, read only.

Public stencils owned by others are locked from editing, while stencils owned by a user is available for editing.

Returns:

Returns true if locked.

Examples:
var stencil = new Vecta.Stencil('stencil_1');

console.log(stencil.locked()); //true

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

Get or set the stencil name.

NameTypeAttributesDescription
namestringoptional

Undefined or null to get, valid name string to set.

Returns:

Returns the stencil name if get, and Vecta.Stencil if set.

.public() Returns: boolean

Indicates if the stencil is set to public access.

Returns:

True if set to public access, false otherwise.

.shared() Returns: boolean

Determines if the stencil is shared. Read only.

Returns:

Returns true if shared.

Examples:
var stencil = new Vecta.Stencil('stencil_1');

console.log(stencil.shared()); //false

.showNames(show)

Determine if the stencil should show names under symbols.

NameTypeDescription
showboolean

Undefined to get, true to show and false to hide names.

Examples:
var stencil = new Vecta.Stencil('example_sid');

console.log(stencil.showNames()); //returns true or false. True means symbol names shown.
console.log(stencil.showNames(true)); //set to show symbol names
console.log(stencil.showNames(false)); //set to hide symbol names.

.symbols([id]) Returns: Vecta.Symbol[]

Get all symbols or a single symbol in the stencil.

NameTypeAttributesDescription
idstringoptional

Get all symbols if undefined, and just get the specific symbol if ID is provided.

Returns:

Returns an array of Vecta.Symbol even if only one symbol is returned.

Examples:
var symbols = new Vecta.Stencil('example_sid').symbols();

.toggle() Returns: Vecta.Stencil

Toggles an opened stencil to expand or collapse.

Capital™ Electra™ X