CanvasLayerGroup
Source: canvas-layers.
CavnasLayer that controls multiple layers
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 |
|
rotateable |
|
Yes |
Is the layer rotateable? Defaults to |
|
resizable |
|
Yes |
Is the layer resizable? Defaults to |
|
selectable |
|
Yes |
Is the layer selectable? Defaults to |
|
forceBoundary |
|
Yes |
Force the layer to stay in bounds? Defaults to |
- Returns
Methods
addLayer(layer) → Promise
Add a layer to the group
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
layer |
|
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 |
|
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 |
|
The layer to remove. |
- Returns
-
Promise