Constructor
new DrawController(drawLayer)
Name | Type | Description |
---|---|---|
drawLayer | DrawLayer | 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 | Konva. | 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() → {Konva.Group|undefined}
Get the current position group.
The Konva.Group.
- Type:
- Konva.
Group |undefined
getDrawDisplayDetails() → {Array.<DrawDetails>}
Get a list of drawing display details.
A list of draw details.
- Type:
- Array.<DrawDetails>
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
getNumberOfDraws() → {number}
Get the total number of draws (at all positions).
The total number of draws.
- Type:
- number
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.<DrawDetails> | 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 | DrawDetails | Details of the drawing to update. |