Class: Layer

Simple layer objects that are managed within the LayerHash.

Implements

Layer Method: constructor

Syntax

var layer = new Layer( options );

Arguments

  1. options - (object) The options for the layer.

Options

Returns

Layer Method: add

Adds an item to the layer.

Syntax

layer.add( item );

Arguments

  1. item - (object) Item to add.

Returns

Layer Method: get

Returns an item.

Syntax

layer.get( itemId );

Arguments

  1. itemId - (string) Id of the Item to return.

Returns

Layer Method: remove

Removes an item from the layer and fires the item's destroy event.

Syntax

layer.remove( itemId );

Arguments

  1. itemId - (string) Id of the Item to return.

Returns

Layer Method: toggle

Toggles the visibility of the layer. Visibility may also be set directly through layer.options.visible

Syntax

layer.toggle( );

Returns

Layer Method: draw

Draws all items on the layer. Usually called by the LayerHash's draw method(which in turn is called by CANVAS' draw method) if the layer's visibility is set to true.

Syntax

layer.draw( );

Returns

Layer Method: promote

Promotes the layer in the stack, calls CANVAS.layers.promote( this.options.id ).

Syntax

layer.promote( );

Returns

Layer Method: demote

Demotes the layer in the stack, calls CANVAS.layers.demote( this.options.id ).

Syntax

layer.demote( );

Returns

Layer Method: swap

Swaps the layer's position with another layer's position in the stack, calls CANVAS.layers.swap( this.options.id, targetId ).

Syntax

layer.demote( targetId );

Arguments

  1. targetId - (string) the id of the layer to swap the position with.

Returns

  1. CANVAS
  2. LayerHash
  3. Layer
  4. CanvasItem
  5. Thread
  6. Cmorph