Skip to content

SprayBrush

Defined in: src/brushes/SprayBrush.ts:31

See

demo

Extends

Constructors

new SprayBrush()

new SprayBrush(canvas): SprayBrush

Defined in: src/brushes/SprayBrush.ts:83

Constructor

Parameters

canvas

Canvas

Returns

SprayBrush

Instance of a spray brush

Overrides

BaseBrush.constructor

Properties

canvas

canvas: Canvas

Defined in: src/brushes/BaseBrush.ts:73

Todo

add type

Inherited from

BaseBrush.canvas


color

color: string = 'rgb(0, 0, 0)'

Defined in: src/brushes/BaseBrush.ts:16

Color of a brush

Default

Inherited from

BaseBrush.color


density

density: number = 20

Defined in: src/brushes/SprayBrush.ts:44

Density of a spray (number of dots per chunk)

Default


dotWidth

dotWidth: number = 1

Defined in: src/brushes/SprayBrush.ts:51

Width of spray dots

Default


dotWidthVariance

dotWidthVariance: number = 1

Defined in: src/brushes/SprayBrush.ts:58

Width variance of spray dots

Default


limitedToCanvasSize

limitedToCanvasSize: boolean = false

Defined in: src/brushes/BaseBrush.ts:68

When true, the free drawing is limited to the whiteboard size. Default to false.

Default

false

Inherited from

BaseBrush.limitedToCanvasSize


optimizeOverlapping

optimizeOverlapping: boolean = true

Defined in: src/brushes/SprayBrush.ts:72

Whether overlapping dots (rectangles) should be removed (for performance reasons)

Default


randomOpacity

randomOpacity: boolean = false

Defined in: src/brushes/SprayBrush.ts:65

Whether opacity of a dot should be random

Default


shadow

shadow: null | Shadow = null

Defined in: src/brushes/BaseBrush.ts:32

Shadow object representing shadow of this shape. Backwards incompatibility note: This property replaces “shadowColor” (String), “shadowOffsetX” (Number), “shadowOffsetY” (Number) and “shadowBlur” (Number) since v1.2.12

Default

Inherited from

BaseBrush.shadow


strokeDashArray

strokeDashArray: null | number[] = null

Defined in: src/brushes/BaseBrush.ts:60

Stroke Dash Array.

Default

Inherited from

BaseBrush.strokeDashArray


strokeLineCap

strokeLineCap: CanvasLineCap = 'round'

Defined in: src/brushes/BaseBrush.ts:39

Line endings style of a brush (one of “butt”, “round”, “square”)

Default

Inherited from

BaseBrush.strokeLineCap


strokeLineJoin

strokeLineJoin: CanvasLineJoin = 'round'

Defined in: src/brushes/BaseBrush.ts:46

Corner style of a brush (one of “bevel”, “round”, “miter”)

Default

Inherited from

BaseBrush.strokeLineJoin


strokeMiterLimit

strokeMiterLimit: number = 10

Defined in: src/brushes/BaseBrush.ts:53

Maximum miter length (used for strokeLineJoin = “miter”) of a brush’s

Default

Inherited from

BaseBrush.strokeMiterLimit


width

width: number = 10

Defined in: src/brushes/SprayBrush.ts:37

Width of a spray

Default

Overrides

BaseBrush.width

Methods

_render()

_render(): void

Defined in: src/brushes/SprayBrush.ts:177

Render all spray chunks

Returns

void

Overrides

BaseBrush._render


addSprayChunk()

addSprayChunk(pointer): void

Defined in: src/brushes/SprayBrush.ts:192

Parameters

pointer

Point

Returns

void


onMouseDown()

onMouseDown(pointer): void

Defined in: src/brushes/SprayBrush.ts:93

Invoked on mouse down

Parameters

pointer

Point

Returns

void

Overrides

BaseBrush.onMouseDown


onMouseMove()

onMouseMove(pointer): void

Defined in: src/brushes/SprayBrush.ts:106

Invoked on mouse move

Parameters

pointer

Point

Returns

void

Overrides

BaseBrush.onMouseMove


onMouseUp()

onMouseUp(): void

Defined in: src/brushes/SprayBrush.ts:117

Invoked on mouse up

Returns

void

Overrides

BaseBrush.onMouseUp


renderChunck()

renderChunck(sprayChunck): void

Defined in: src/brushes/SprayBrush.ts:159

Parameters

sprayChunck

SprayBrushPoint[]

Returns

void