DrawWidget

DrawWidget

Widget to obtain user-provided drawings or signature.

Constructor

new DrawWidget()

Source:

Extends

Members

(static) selector :string

Source:
Type:
  • string

(readonly) downloadButtonHtml :Element

Source:
Inherited From:

Returns a HTML document fragment for a download button.

Type:
  • Element

(readonly) originalInputValue :*

Source:
Overrides:

Obtains the value from the original form control the widget is instantiated on. This form control is often hidden by the widget.

Type:
  • *

props :object

Source:
Overrides:
Type:
  • object

(readonly) resetButtonHtml :Element

Source:
Inherited From:

Returns a HTML document fragment for a reset button.

Type:
  • Element

value :string

Source:
Overrides:
Type:
  • string

Methods

_getMarkup() → {DocumentFragment}

Source:
Returns:

a document fragment with the widget markup

Type
DocumentFragment

_getProps() → {object}

Source:
Inherited From:

Not meant to be overridden, but could be. Recommend to extend get props() instead.

Returns:

props object

Type
object

_handleFiles(loadedFileName)

Source:
Parameters:
Name Type Description
loadedFileName string

the loaded filename

_handleResize(canvas)

Source:

Forces update and resizes canvas on window resize

Parameters:
Name Type Description
canvas Element

Canvas element

_init()

Source:
Overrides:

Meant to be overridden, but automatically called.

_loadFileIntoPad(file) → {Promise}

Source:
Parameters:
Name Type Description
file string | File

Either a filename or a file.

Returns:

promise resolving with a string

Type
Promise

_reset()

Source:

Clears pad, cache, loaded file name, download link and others

_resizeCanvas(canvas)

Source:

Adjust canvas coordinate space taking into account pixel ratio, to make it look crisp on mobile devices. This also causes canvas to be cleared.

Parameters:
Name Type Description
canvas Element

Canvas element

_showFeedback(message)

Source:
Parameters:
Name Type Description
message string

the feedback message to show

_showFileName(fileName)

Source:
Parameters:
Name Type Description
fileName string

filename to show

Source:
Parameters:
Name Type Description
url string

the download URL

_updatePlaceholder()

Source:

Updates placeholder

_updateValue(changedopt)

Source:

Updates value

Parameters:
Name Type Attributes Default Description
changed boolean <optional>
true

whether the value has changed

disable()

Source:
Overrides:

Disables widget

enable()

Source:
Overrides:

Enables widget

update()

Source:
Overrides:

Updates value when it is programmatically cleared. There is no way to programmatically update a file input other than clearing it, so that's all we need to do.