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