Extends
Members
decimate :Number
Discard points that are less than `decimate` pixel distant from each other
Type:
- Number
- Default Value:
- 0.4
- Source:
drawStraightLine :boolean
Draws a straight line between last recorded point to current pointer
Used for `shift` functionality
Type:
- boolean
- Default Value:
- false
- Source:
limitedToCanvasSize :Boolean
When `true`, the free drawing is limited to the whiteboard size. Default to false.
Type:
- Boolean
- Inherited From:
- Default Value:
- false
- Source:
shadow :fabric.Shadow
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
Type:
- Inherited From:
- Source:
straightLineKey :'altKey'|'shiftKey'|'ctrlKey'|'none'|undefined|null
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.
Type:
- 'altKey' | 'shiftKey' | 'ctrlKey' | 'none' | undefined | null
- Source:
strokeLineCap :String
Line endings style of a brush (one of "butt", "round", "square")
Type:
- String
- Inherited From:
- Default Value:
- round
- Source:
strokeLineJoin :String
Corner style of a brush (one of "bevel", "round", "miter")
Type:
- String
- Inherited From:
- Default Value:
- round
- Source:
strokeMiterLimit :Number
Maximum miter length (used for strokeLineJoin = "miter") of a brush's
Type:
- Number
- Inherited From:
- Default Value:
- 10
- Source:
width :Number
Width of a brush, has to be a Number, no string literals
Type:
- Number
- Inherited From:
- Default Value:
- 1
- Source:
Methods
_drawSegment(pointer)
Invoked inside on mouse down and mouse move
Parameters:
Name | Type | Description |
---|---|---|
pointer |
Object |
- Source:
_finalizeAndAddPath()
On mouseup after drawing the path on contextTop canvas
we use the points captured to create an new fabric path object
and add it to the fabric canvas.
- Source:
convertPointsToSVGPath(points)
Converts points to SVG path
Parameters:
Name | Type | Description |
---|---|---|
points |
Array | Array of points |
- Source:
Returns:
createPath() → {fabric.Path}
Creates fabric.Path object to add on canvas
Parameters:
Type | Description |
---|---|
- Source:
Returns:
Path to add on canvas
- Type
- fabric.Path
decimatePoints()
Decimate points array with the decimate value
- Source:
initialize(canvas) → {fabric.PencilBrush}
Constructor
Parameters:
Name | Type | Description |
---|---|---|
canvas |
fabric.Canvas |
- Source:
Returns:
Instance of a pencil brush
- Type
- fabric.PencilBrush
onMouseDown(pointer)
Invoked on mouse down
Parameters:
Name | Type | Description |
---|---|---|
pointer |
Object |
- Source:
onMouseMove(pointer)
Invoked on mouse move
Parameters:
Name | Type | Description |
---|---|---|
pointer |
Object |
- Source:
onMouseUp()
Invoked on mouse up
- Source: