Options

These are the Props and Methods for the paintable canvas.

Props#

name typedefaultrequireddescription
widthnumberyesthe canvas width, can only be initialized and not be changed later
heightnumberyesthe canvas height, can only be initialized and not be changed later
activebooleanyesflag if the canvas is active (foreground/background)
scaleFactornumber1noif you use the paintable in a scaled envirionment set the scalefactor to get the correct x/y values
useEraserbooleanfalsenoflag if the eraser is enabled
thicknessErasernumber40nowidth of the eraser when it is active
thicknessnumber10nowidth of the pencil while drawing
colorstring#000000nothe pencilcolor MUST be a hex value. Other strings wont work right now
imagestringnullnoinitial image (base64) drawn from the canvas
onSave(image: string) => voidnoThe event is emitted when the paintable state toggles from active: true -> active: false. When the event is emitted you get the current canvas image as a base64 string
onLongPress() => voidnoThe event is emitted when you longpress the canvas while it is active. Very useful to tigger a custom navigation.

Methods#

The Paintable hast some Methods you can execute.

namedescription
undoUndo the last drawing step
redoRedo the last drawing step
clearClear the canvas screen