Constructor
new DrawController(konvaLayer)
Name | Type | Description |
---|---|---|
konvaLayer | Konva. | The draw layer. |
Classes
Methods
activateDrawLayer(index, scrollIndex)
Activate the current draw layer.
Name | Type | Description |
---|---|---|
index | Index | The current position. |
scrollIndex | number | The scroll index. |
deleteDraw(id, cmdCallback, exeCallback) → {boolean}
Delete a Draw from the stage.
Name | Type | Description |
---|---|---|
id | string | The id of the group to delete. |
cmdCallback | function | The DeleteCommand callback. |
exeCallback | function | The callback to call once the DeleteCommand has been executed. |
False if the group cannot be found.
- Type:
- boolean
deleteDrawGroup(group, cmdCallback, exeCallback)
Delete a Draw from the stage.
Name | Type | Description |
---|---|---|
group | object | The group to delete. |
cmdCallback | object | The DeleteCommand callback. |
exeCallback | object | The callback to call once the DeleteCommand has been executed. |
deleteDraws(cmdCallback, exeCallback)
Delete all Draws from the stage.
Name | Type | Description |
---|---|---|
cmdCallback | function | The DeleteCommand callback. |
exeCallback | function | The callback to call once the DeleteCommand has been executed. |
getCurrentPosGroup() → {object}
Get the current position group.
The Konva.Group.
- Type:
- object
getDrawDisplayDetails() → {Array}
Get a list of drawing display details.
A list of draw details as {id, position, type, color, meta}
- Type:
- Array
getDrawStoreDetails() → {object}
Get a list of drawing store details. Used in state.
A list of draw details including id, text, quant... TODO Unify with getDrawDisplayDetails?
- Type:
- object
getGroup(id) → {object|undefined}
Get a Konva group using its id.
Name | Type | Description |
---|---|---|
id | string | The group id. |
The Konva group.
- Type:
- object |
undefined
reset()
Reset: clear the layers array.
setDrawings(drawings, drawingsDetails, cmdCallback, exeCallback)
Set the drawings on the current stage.
Name | Type | Description |
---|---|---|
drawings | Array | An array of drawings. |
drawingsDetails | Array | An array of drawings details. |
cmdCallback | object | The DrawCommand callback. |
exeCallback | object | The callback to call once the DrawCommand has been executed. |
updateDraw(drawDetails)
Update a drawing from its details.
Name | Type | Description |
---|---|---|
drawDetails | object | Details of the drawing to update. |