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:
  • Vecta.loadStencil, Vecta.CreateStencil

Properties

.$jQuery

The jQuery wrapped node for the stencil.

NameTypeDescription
$jQuery

jQuery wrapper for stencil node.

Methods

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

Function to create a symbol from a given shape and adds it into the stencil.

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

NameTypeAttributesDescription
shapeVecta.Shape

A Vecta.Shape to be added to the stencil.

indexnumberoptional

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

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

Get or set stencil category.

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

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 for chaining.

.close() Returns: Vecta.Stencil

Close the current stencil in the editor. Once closed, search stencil can no longer be reopened.

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

Returns:

For chaining.

.delete() Returns: Vecta.Stencil

Deletes the current stencil. Once deleted, search stencil can not be reopened anymore.

User must have access to the stencil to delete it.

Returns:

For chaining.

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

Get or set stencil description.

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

NameTypeAttributesDescription
descstringoptional

Undefined to get, valid descriptions string to set.

Returns:

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

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

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

NameTypeAttributesDescription
namestringoptional

Undefined or null for read, values for write

Returns:

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

.public() Returns: boolean

Gets stencil access.

.shared() Returns: boolean

Determines if the stencil is shared. This is read only.

Returns:

Returns true if shared.

Examples:
var stencil = new Vecta.Stencil('stencil_1');
console.log(stencil.shared()); //false

.showNames(show)

Gets or sets setting that shows or hides the symbol names under this stencil.

NameTypeDescription
showboolean

True to show. False to hide. Undefined to get.

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

console.log(stencil.showNames()); //returns true or false. True means symbol names shown. False means hidden.
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 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.

.toggle() Returns: Vecta.Stencil

Toggles an opened stencil to expand or collapse.

Returns:

For chaining.