DrawController

Draw controller.

Constructor

new DrawController(drawLayer)

Parameters:
NameTypeDescription
drawLayerDrawLayer

The draw layer.

Classes

DrawController

Methods

activateDrawLayer(index, scrollIndex)

Activate the current draw layer.

Parameters:
NameTypeDescription
indexIndex

The current position.

scrollIndexnumber

The scroll index.

deleteDraw(id, cmdCallback, exeCallback) → {boolean}

Delete a Draw from the stage.

Parameters:
NameTypeDescription
idstring

The id of the group to delete.

cmdCallbackfunction

The DeleteCommand callback.

exeCallbackfunction

The callback to call once the DeleteCommand has been executed.

Returns:

False if the group cannot be found.

Type: 
boolean

deleteDrawGroup(group, cmdCallback, exeCallback)

Delete a Draw from the stage.

Parameters:
NameTypeDescription
groupKonva.Group

The group to delete.

cmdCallbackobject

The DeleteCommand callback.

exeCallbackobject

The callback to call once the DeleteCommand has been executed.

deleteDraws(cmdCallback, exeCallback)

Delete all Draws from the stage.

Parameters:
NameTypeDescription
cmdCallbackfunction

The DeleteCommand callback.

exeCallbackfunction

The callback to call once the DeleteCommand has been executed.

getCurrentPosGroup() → {Konva.Group|undefined}

Get the current position group.

Returns:

The Konva.Group.

Type: 
Konva.Group | undefined

getDrawDisplayDetails() → {Array.<DrawDetails>}

Get a list of drawing display details.

Returns:

A list of draw details.

Type: 
Array.<DrawDetails>

getDrawStoreDetails() → {object}

Get a list of drawing store details. Used in state.

Returns:

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.

Parameters:
NameTypeDescription
idstring

The group id.

Returns:

The Konva group.

Type: 
object | undefined

getNumberOfDraws() → {number}

Get the total number of draws (at all positions).

Returns:

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.

Parameters:
NameTypeDescription
drawingsArray

An array of drawings.

drawingsDetailsArray.<DrawDetails>

An array of drawings details.

cmdCallbackobject

The DrawCommand callback.

exeCallbackobject

The callback to call once the DrawCommand has been executed.

updateDraw(drawDetails)

Update a drawing from its details.

Parameters:
NameTypeDescription
drawDetailsDrawDetails

Details of the drawing to update.