DWVv0.37.0

Draw

Source: draw.js:17

Drawing tool.


Constructor

new Draw(app: App): Draw

Parameters

  • app (App) — The associated application.

Instance Methods

cancel()

Cancel the current placement: clear the shape preview and end the behaviors.

activate(bool: boolean)

Activate the tool.

Parameters

  • bool (boolean) — The flag to activate or not.

setOptions(options: object)

Set the tool configuration options.

Parameters

  • options (object) — The list of shape names amd classes.

getOptionsType(): string

Get the type of tool options: here 'factory' since the shape list contains factories to create each possible shape.

Returns

  • string — The type.

setFeatures(features: object)

Set the tool live features.

Parameters

  • features (object) — The list of features.

init()

Initialise the tool.

getEventNames(): Array.<string>

Get the list of event names that this tool can fire.

Returns

  • Array.<string> — The list of event names.

hasShape(name: string): boolean

Check if the shape is in the shape list.

Parameters

  • name (string) — The name of the shape.

Returns

  • boolean — True if there is a factory for the shape.

Instance Fields

keydown

Handle key down event.

Parameters

  • event (object) — The key down event.