new CanvasLayerGroup(name[, draggable][, rotateable][, resizable][, selectable][, forceBoundary])

Create a new Layer.

Parameters

Name Type Optional Description

name

 

 

The name of the layer.

draggable

 

Yes

Is the layer draggable?

Defaults to true.

rotateable

 

Yes

Is the layer rotateable?

Defaults to true.

resizable

 

Yes

Is the layer resizable?

Defaults to true.

selectable

 

Yes

Is the layer selectable?

Defaults to true.

forceBoundary

 

Yes

Force the layer to stay in bounds?

Defaults to false.

Returns

Methods

addLayer(layer) → Promise

Add a layer to the group

Parameter

Name Type Optional Description

layer

CanvasLayer

 

The layer to add.

Returns

Promise 

getLayerOrSubLayerAt(canvas, x, y) → (layer or null)

Get the layer on the given canvas at the given position. If this group is selected it will return the layer in this group at the given position, if applicatble.

Parameters

Name Type Optional Description

canvas

Canvas

 

The Canvas element that owns the layers.

x

Number

 

The x position of the mouseclick relative to the canvas.

y

Number

 

The y position of the mouseclick relative to the canvas.

Returns

(layer or null) 

removeLayer(layer) → Promise

Remove the provided layer from the group.

Parameter

Name Type Optional Description

layer

CanvasLayer

 

The layer to remove.

Returns

Promise