Extends
Members
color :String
- Source:
- Inherited From:
- Default Value:
- rgb(0, 0, 0)
Color of a brush
Type:
- String
decimate :Number
- Source:
- Default Value:
- 0.4
Discard points that are less than `decimate` pixel distant from each other
Type:
- Number
limitedToCanvasSize :Boolean
- Source:
- Inherited From:
- Default Value:
- false
When `true`, the free drawing is limited to the whiteboard size. Default to false.
Type:
- Boolean
shadow :fabric.Shadow
- Source:
- Inherited From:
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:
strokeDashArray :Array
- Source:
- Inherited From:
Stroke Dash Array.
Type:
- Array
strokeLineCap :String
- Source:
- Inherited From:
- Default Value:
- round
Line endings style of a brush (one of "butt", "round", "square")
Type:
- String
strokeLineJoin :String
- Source:
- Inherited From:
- Default Value:
- round
Corner style of a brush (one of "bevel", "round", "miter")
Type:
- String
strokeMiterLimit :Number
- Source:
- Inherited From:
- Default Value:
- 10
Maximum miter length (used for strokeLineJoin = "miter") of a brush's
Type:
- Number
width :Number
- Source:
- Inherited From:
- Default Value:
- 1
Width of a brush, has to be a Number, no string literals
Type:
- Number
Methods
_drawSegment(pointer)
- Source:
Invoked inside on mouse down and mouse move
Parameters:
Name | Type | Description |
---|---|---|
pointer |
Object |
_finalizeAndAddPath()
- Source:
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.
convertPointsToSVGPath(points) → {String}
- Source:
Converts points to SVG path
Parameters:
Name | Type | Description |
---|---|---|
points |
Array | Array of points |
Returns:
SVG path
- Type
- String
createPath(pathData) → {fabric.Path}
- Source:
Creates fabric.Path object to add on canvas
Parameters:
Name | Type | Description |
---|---|---|
pathData |
String | Path data |
Returns:
Path to add on canvas
- Type
- fabric.Path
decimatePoints()
- Source:
Decimate points array with the decimate value
initialize(canvas) → {fabric.PencilBrush}
- Source:
Constructor
Parameters:
Name | Type | Description |
---|---|---|
canvas |
fabric.Canvas |
Returns:
Instance of a pencil brush
- Type
- fabric.PencilBrush
onMouseDown(pointer)
- Source:
Invoked on mouse down
Parameters:
Name | Type | Description |
---|---|---|
pointer |
Object |
onMouseMove(pointer)
- Source:
Invoked on mouse move
Parameters:
Name | Type | Description |
---|---|---|
pointer |
Object |
onMouseUp()
- Source:
Invoked on mouse up