Class: Layer

model/Presentation.Layer(presentation, label, auto)

A layer in an SVG document.

The SVG standard does not define a notion of layer. The implementation of layers depends on the software that was used to create the SVG document.

In Sozi, a layer is an SVG group that is a direct child of the SVG root element. When Sozi opens an SVG document, elements that do not belong to a layer are grouped automatically into automatic layers.

Constructor

new Layer(presentation, label, auto)

Initialize a new layer.

Parameters:
Name Type Description
presentation module:model/Presentation.Presentation

The current Sozi presentation.

label string

The display name of this layer.

auto boolean

Was the layer created by Sozi to collect isolated elements?

Source:

Members

auto :boolean

Was the layer created by Sozi to collect isolated elements?

Type:
  • boolean
Source:

groupId :string

The identifier of the SVG group for this layer.

If auto is true, the value of this property is "__sozi_auto__".

Type:
  • string
Source:

index :number

The index of this layer.

Type:
  • number
Source:

isVisible :boolean

Is this layer visible?

This property corresponds to the CSS display property of the SVG group for this layer.

Type:
  • boolean
Source:

label :string

The display name of this layer.

Type:
  • string
Source:

presentation :module:model/Presentation.Presentation

The current presentation.

Type:
Source:

svgNodes :Array.<SVGElement>

The SVG element(s) that constitute this layer.

If auto is false, this array will contain a single SVG group element. If auto is true, this array can contain several groups that are managed as a single layer in Sozi.

Type:
  • Array.<SVGElement>
Source:

Methods

contains(svgElement) → {boolean}

Does this layer contain the given SVG element?

Parameters:
Name Type Description
svgElement SVGElement

An element to check.

Source:
Returns:

true if the given element is a child of the current layer.

Type
boolean