Class PencilBrush

See

demo

Hierarchy

Constructors

Properties

_hasStraightLine: boolean
_points: Point[]
canvas: Canvas

Todo

add type

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

Color of a brush

Default


decimate: number = 0.4

Discard points that are less than decimate pixel distant from each other

Default

0.4
drawStraightLine: boolean = false

Draws a straight line between last recorded point to current pointer Used for shift functionality

Default

false
limitedToCanvasSize: boolean = false

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

Default

false
oldEnd?: Point
shadow: null | Shadow = null

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


straightLineKey: undefined | null | "altKey" | "shiftKey" | "ctrlKey" | "metaKey" = 'shiftKey'

The event modifier key that makes the brush draw a straight line. If null or 'none' or any other string that is not a modifier key the feature is disabled.

strokeDashArray: null | number[] = null

Stroke Dash Array.

Default


strokeLineCap: CanvasLineCap = 'round'

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

Default


strokeLineJoin: CanvasLineJoin = 'round'

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

Default


strokeMiterLimit: number = 10

Maximum miter length (used for strokeLineJoin = "miter") of a brush's

Default


width: number = 1

Width of a brush, has to be a Number, no string literals

Default


Methods

  • On mouseup after drawing the path on contextTop canvas we use the points captured to create an new Path object and add it to the canvas.

    Returns void

Generated using TypeDoc