DrawController

dwv.ctrl. DrawController

new DrawController(konvaLayer)

Source:

Draw controller.

Parameters:
Name Type Description
konvaLayer object

The draw layer.

Methods

activateDrawLayer(index, scrollIndex)

Source:

Activate the current draw layer.

Parameters:
Name Type Description
index dwv.math.Index

The current position.

scrollIndex number

The scroll index.

deleteDrawGroup(group, cmdCallback, exeCallback)

Source:

Delete a Draw from the stage.

Parameters:
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.

deleteDrawGroupId(groupId, cmdCallback, exeCallback)

Source:

Delete a Draw from the stage.

Parameters:
Name Type Description
groupId number

The group id of the group to delete.

cmdCallback object

The DeleteCommand callback.

exeCallback object

The callback to call once the DeleteCommand has been executed.

deleteDraws(cmdCallback, exeCallback)

Source:

Delete all Draws from the stage.

Parameters:
Name Type Description
cmdCallback object

The DeleteCommand callback.

exeCallback object

The callback to call once the DeleteCommand has been executed.

getCurrentPosGroup() → {object}

Source:

Get the current position group.

Returns:

The Konva.Group.

Type
object

getDrawDisplayDetails() → {Array}

Source:

Get a list of drawing display details.

Returns:

A list of draw details as {id, position, type, color, meta}

Type
Array

getDrawStoreDetails() → {object}

Source:

Get a list of drawing store details.

Returns:

A list of draw details including id, text, quant... TODO Unify with getDrawDisplayDetails?

Type
object

isGroupVisible(drawDetails) → {boolean}

Source:

Check the visibility of a given group.

Parameters:
Name Type Description
drawDetails object

Details of the group to check.

Returns:

True if the group is visible.

Type
boolean

reset()

Source:

Reset: clear the layers array.

setDrawings(drawings, drawingsDetails, cmdCallback, exeCallback)

Source:

Set the drawings on the current stage.

Parameters:
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.

toogleGroupVisibility(drawDetails) → {boolean}

Source:

Toggle the visibility of a given group.

Parameters:
Name Type Description
drawDetails object

Details of the group to update.

Returns:

False if the group cannot be found.

Type
boolean

updateDraw(drawDetails)

Source:

Update a drawing from its details.

Parameters:
Name Type Description
drawDetails object

Details of the drawing to update.