Provides logical grouping of Element objects.
Layers are commonly used to group objects in the drawing by function (for example, walls or furniture), but in principle they can represent any type of virtual grouping. All objects in a layer share appearance and can be shown and hidden together. A drawing element can belong to only one layer.
The drawing layer holds an isVisible attribute, which is true by default.
new Layer(
name?):Layer
Creates a layer.
string
Optional name assigned to the layer.
Layer
isVisible:
boolean=true
Indicates whether the drawing layer is visible.
get id():
bigint
Returns the unique identifier of the object.
bigint
get name():
string|null
Name of the drawing layer.
The value is null if the layer has no name.
string | null
set name(
name):void
Sets the name of the drawing layer.
string | null
Name to assign to the drawing layer.
void
get uuid():
`${string}-${string}-${string}-${string}-${string}`|null
UUID of the drawing layer.
The value is null if no UUID is assigned.
`${string}-${string}-${string}-${string}-${string}` | null
set uuid(
uuid):void
Sets the UUID of the drawing layer.
`${string}-${string}-${string}-${string}-${string}` | null
UUID to assign to the drawing layer.
void
accept(
visitor):void
Accepts an element visitor.
Calls the visitor for each element in the drawing layer.
Element visitor to accept.
void
add(
element):void
Adds an element to the drawing layer.
If the element has already been added or belongs to another layer, the method does nothing.
Drawing element to add.
void
isContaining(
element):boolean
Returns true if the element belongs to the drawing layer.
Drawing element.
boolean
remove(
element):boolean
Removes an element from the drawing layer.
Returns true if the element was removed.
Drawing element to remove.
boolean