Extends
Members
decimate :Number
丢弃距离小于“抽取”像素的点
Type:
- Number
- Default Value:
- 0.4
- Source:
drawStraightLine :boolean
在上次记录的点与当前指针之间绘制直线
用于“shift”功能
Type:
- boolean
- Default Value:
- false
- Source:
limitedToCanvasSize :Boolean
当为“true”时,自由绘图将被限制在白板大小内。默认为false。
Type:
- Boolean
- Inherited From:
- Default Value:
- false
- Source:
shadow :fabric.Shadow
表示此形状的阴影的阴影对象。
向后不兼容注意:这个属性取代了"shadowColor" (String), "shadowOffsetX" (Number),
“shadowOffsetY”(Number)和“shadowBlur”(Number)自v1.2.12
Type:
- Inherited From:
- Source:
straightLineKey :'altKey'|'shiftKey'|'ctrlKey'|'none'|undefined|null
使画笔绘制直线的事件修饰符键。
如果' null '或'none'或任何其他不是修饰符键的字符串,则禁用该功能。
Type:
- 'altKey' | 'shiftKey' | 'ctrlKey' | 'none' | undefined | null
- Source:
strokeLineCap :String
笔刷的线尾样式(有“屁股”、“圆”、“方”三种)
Type:
- String
- Inherited From:
- Default Value:
- round
- Source:
strokeLineJoin :String
笔刷的角样式(“斜角”,“圆”,“斜字”之一)
Type:
- String
- Inherited From:
- Default Value:
- round
- Source:
strokeMiterLimit :Number
笔刷的最大斜接长度(用于strokeLineJoin = "斜接")
Type:
- Number
- Inherited From:
- Default Value:
- 10
- Source:
Methods
_drawSegment(pointer)
在鼠标下移和鼠标移动时调用
Parameters:
Name | Type | Description |
---|---|---|
pointer |
Object |
- Source:
_finalizeAndAddPath()
在contextTop画布上绘制路径后点击鼠标
我们使用捕获的点来创建一个新的织物路径对象
并将其添加到织物画布中。
- Source:
convertPointsToSVGPath(points)
将点转换为SVG路径
Parameters:
Name | Type | Description |
---|---|---|
points |
Array | 点数组 |
- Source:
Returns:
createPath() → {fabric.Path}
创建织物。要添加到画布上的路径对象
Parameters:
Type | Description |
---|---|
- Source:
Returns:
Path to add on canvas
- Type
- fabric.Path
decimatePoints()
使用十进制值抽取点数组
- Source:
initialize(canvas) → {fabric.PencilBrush}
构造函数
Parameters:
Name | Type | Description |
---|---|---|
canvas |
fabric.Canvas |
- Source:
Returns:
Instance of a pencil brush
- Type
- fabric.PencilBrush
onMouseDown(pointer)
按下鼠标调用
Parameters:
Name | Type | Description |
---|---|---|
pointer |
Object |
- Source:
onMouseMove(pointer)
鼠标移动时调用
Parameters:
Name | Type | Description |
---|---|---|
pointer |
Object |
- Source:
onMouseUp()
鼠标向上调用
- Source: