PatternBrush
Defined in: src/brushes/PatternBrush.ts:7
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new PatternBrush(
canvas
):PatternBrush
Defined in: src/brushes/PatternBrush.ts:10
Parameters
Section titled “Parameters”canvas
Section titled “canvas”Returns
Section titled “Returns”PatternBrush
Overrides
Section titled “Overrides”Properties
Section titled “Properties”canvas
Section titled “canvas”canvas:
Canvas
Defined in: src/brushes/BaseBrush.ts:73
add type
Inherited from
Section titled “Inherited from”color:
string
='rgb(0, 0, 0)'
Defined in: src/brushes/BaseBrush.ts:16
Color of a brush
Default
Section titled “Default”
Inherited from
Section titled “Inherited from”decimate
Section titled “decimate”decimate:
number
=0.4
Defined in: src/brushes/PencilBrush.ts:25
Discard points that are less than decimate
pixel distant from each other
Default
Section titled “Default”0.4
Inherited from
Section titled “Inherited from”drawStraightLine
Section titled “drawStraightLine”drawStraightLine:
boolean
=false
Defined in: src/brushes/PencilBrush.ts:34
Draws a straight line between last recorded point to current pointer
Used for shift
functionality
Default
Section titled “Default”false
Inherited from
Section titled “Inherited from”limitedToCanvasSize
Section titled “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
Section titled “Default”false
Inherited from
Section titled “Inherited from”PencilBrush
.limitedToCanvasSize
shadow
Section titled “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
Section titled “Default”
Inherited from
Section titled “Inherited from”source?
Section titled “source?”
optional
source:CanvasImageSource
Defined in: src/brushes/PatternBrush.ts:8
straightLineKey
Section titled “straightLineKey”straightLineKey:
undefined
|null
|"altKey"
|"ctrlKey"
|"metaKey"
|"shiftKey"
='shiftKey'
Defined in: src/brushes/PencilBrush.ts:41
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.
Inherited from
Section titled “Inherited from”strokeDashArray
Section titled “strokeDashArray”strokeDashArray:
null
|number
[] =null
Defined in: src/brushes/BaseBrush.ts:60
Stroke Dash Array.
Default
Section titled “Default”
Inherited from
Section titled “Inherited from”strokeLineCap
Section titled “strokeLineCap”strokeLineCap:
CanvasLineCap
='round'
Defined in: src/brushes/BaseBrush.ts:39
Line endings style of a brush (one of “butt”, “round”, “square”)
Default
Section titled “Default”
Inherited from
Section titled “Inherited from”strokeLineJoin
Section titled “strokeLineJoin”strokeLineJoin:
CanvasLineJoin
='round'
Defined in: src/brushes/BaseBrush.ts:46
Corner style of a brush (one of “bevel”, “round”, “miter”)
Default
Section titled “Default”
Inherited from
Section titled “Inherited from”strokeMiterLimit
Section titled “strokeMiterLimit”strokeMiterLimit:
number
=10
Defined in: src/brushes/BaseBrush.ts:53
Maximum miter length (used for strokeLineJoin = “miter”) of a brush’s
Default
Section titled “Default”
Inherited from
Section titled “Inherited from”width:
number
=1
Defined in: src/brushes/BaseBrush.ts:23
Width of a brush, has to be a Number, no string literals
Default
Section titled “Default”
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”_finalizeAndAddPath()
Section titled “_finalizeAndAddPath()”_finalizeAndAddPath():
void
Defined in: src/brushes/PencilBrush.ts:273
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
Section titled “Returns”void
Inherited from
Section titled “Inherited from”PencilBrush
._finalizeAndAddPath
_setBrushStyles()
Section titled “_setBrushStyles()”_setBrushStyles(
ctx
):void
Defined in: src/brushes/PatternBrush.ts:50
Sets brush styles
Parameters
Section titled “Parameters”CanvasRenderingContext2D
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”PencilBrush._setBrushStyles
convertPointsToSVGPath()
Section titled “convertPointsToSVGPath()”convertPointsToSVGPath(
points
):TSimplePathData
Defined in: src/brushes/PencilBrush.ts:212
Converts points to SVG path
Parameters
Section titled “Parameters”points
Section titled “points”Point
[]
Array of points
Returns
Section titled “Returns”SVG path commands
Inherited from
Section titled “Inherited from”PencilBrush
.convertPointsToSVGPath
createPath()
Section titled “createPath()”createPath(
pathData
):Path
<Partial
<PathProps
>,SerializedPathProps
,ObjectEvents
>
Defined in: src/brushes/PatternBrush.ts:59
Creates path
Parameters
Section titled “Parameters”pathData
Section titled “pathData”Returns
Section titled “Returns”Path
<Partial
<PathProps
>, SerializedPathProps
, ObjectEvents
>
Overrides
Section titled “Overrides”decimatePoints()
Section titled “decimatePoints()”decimatePoints(
points
,distance
):Point
[]
Defined in: src/brushes/PencilBrush.ts:243
Decimate points array with the decimate value
Parameters
Section titled “Parameters”points
Section titled “points”Point
[]
distance
Section titled “distance”number
Returns
Section titled “Returns”Point
[]
Inherited from
Section titled “Inherited from”getPattern()
Section titled “getPattern()”getPattern(
ctx
):null
|CanvasPattern
Defined in: src/brushes/PatternBrush.ts:42
Creates “pattern” instance property
Parameters
Section titled “Parameters”CanvasRenderingContext2D
Returns
Section titled “Returns”null
| CanvasPattern
getPatternSrc()
Section titled “getPatternSrc()”getPatternSrc():
HTMLCanvasElement
Defined in: src/brushes/PatternBrush.ts:14
Returns
Section titled “Returns”HTMLCanvasElement
needsFullRender()
Section titled “needsFullRender()”needsFullRender():
boolean
Defined in: src/brushes/PencilBrush.ts:53
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”onMouseDown()
Section titled “onMouseDown()”onMouseDown(
pointer
,__namedParameters
):void
Defined in: src/brushes/PencilBrush.ts:67
Invoked on mouse down
Parameters
Section titled “Parameters”pointer
Section titled “pointer”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”onMouseMove()
Section titled “onMouseMove()”onMouseMove(
pointer
,__namedParameters
):void
Defined in: src/brushes/PencilBrush.ts:83
Invoked on mouse move
Parameters
Section titled “Parameters”pointer
Section titled “pointer”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”onMouseUp()
Section titled “onMouseUp()”onMouseUp(
__namedParameters
):boolean
Defined in: src/brushes/PencilBrush.ts:121
Invoked on mouse up
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”drawSegment()
Section titled “drawSegment()”
static
drawSegment(ctx
,p1
,p2
):Point
Defined in: src/brushes/PencilBrush.ts:57
Parameters
Section titled “Parameters”CanvasRenderingContext2D