Members
__cachedLines :Array
缓存的文本换行数组。
Type:
- Array
- Source:
dynamicMinWidth :Number
文本框的最小计算宽度,以像素为单位。
修正为2,使空文本框不能变为0
并且在没有文本的情况下仍然可以选择。
Type:
- Number
- Default Value:
- 2
- Source:
lockScalingFlip
覆盖标准对象类值
- Source:
minWidth :Number
文本框的最小宽度,以像素为单位。
Type:
- Number
- Default Value:
- 20
- Source:
noScaleCache
覆盖标准对象类值
文本框需要设置为false
- Source:
splitByGrapheme :Boolean
使用这个布尔属性来分割没有空白概念的字符串。
这是一种帮助学习中文/日语的廉价方法
Type:
- Boolean
- Since:
- 2.6.0
- Source:
type :String
对象的类型
Type:
- String
- Default Value:
- textbox
- Source:
Methods
_splitTextIntoLines(text) → {Array}
获取要在文本框中呈现的文本行。这个函数计算
每次调用时动态地进行文本换行。
Parameters:
Name | Type | Description |
---|---|---|
text |
String | 要分割的文本 |
- Source:
Returns:
Array of lines in the Textbox.
- Type
- Array
_wrapLine(line, lineIndex, desiredWidth, reservedSpace) → {Array}
使用文本框和上下文的宽度换行文本行。
Parameters:
Name | Type | Description |
---|---|---|
line |
Array | 表示行的字形数组 |
lineIndex |
Number | |
desiredWidth |
Number | 想要换行的宽度 |
reservedSpace |
Number | 要从自定义功能的包装中删除的空间 |
- Source:
Returns:
Array of line(s) into which the given text is wrapped
to.
- Type
- Array
_wrapText(lines, desiredWidth) → {Array}
使用Textbox的'width'属性换行文本。首先这个函数
按换行拆分文本,因此我们保留用户输入的换行符。
然后使用文本框的宽度对每行行进行换行
_wrapLine()。
Parameters:
Name | Type | Description |
---|---|---|
lines |
Array | 分割成行的文本字符串数组 |
desiredWidth |
Number | 想要换行的宽度 |
- Source:
Returns:
Array of lines
- Type
- Array
applyFilters(filters, forResizing) → {thisArg}
应用分配给该图像的过滤器(来自“filters”数组)或过滤器参数
Parameters:
Name | Type | Description |
---|---|---|
filters |
Array | 待应用 |
forResizing |
Boolean | 指定过滤器操作是否为调整大小操作 |
- Source:
Returns:
return the fabric.Image object
- Type
- thisArg
cancelAll() → {Array.<AnimationContext>}
在下一个requestAnimFrame时取消所有正在运行的动画
Returns:
- Type
- Array.<AnimationContext>
cancelByCanvas(canvas) → {Array.<AnimationContext>}
在下一个requestAnimFrame时取消画布上所有正在运行的动画
Parameters:
Name | Type | Description |
---|---|---|
canvas |
fabric.Canvas |
Returns:
- Type
- Array.<AnimationContext>
cancelByTarget(target) → {Array.<AnimationContext>}
在下一个requestAnimFrame时取消所有正在运行的动画
Parameters:
Name | Type | Description |
---|---|---|
target |
* |
Returns:
- Type
- Array.<AnimationContext>
copyGLTo2DDrawImage(sourceContext, targetCanvas, pipelineState)
将输入WebGL画布复制到输出2D画布上。
WebGL画布被假设为上下颠倒,左上角像素为
所需的输出图像出现在WebGL画布的左下角。
Parameters:
Name | Type | Description |
---|---|---|
sourceContext |
WebGLRenderingContext | 要从中复制的WebGL上下文。 |
targetCanvas |
HTMLCanvasElement | 要复制到的2D目标画布。 |
pipelineState |
Object | 要复制到的2D目标画布。 |
- Source:
copyGLTo2DPutImageData(sourceContext, targetCanvas, pipelineState)
使用2D canvas的putImageData将输入的WebGL画布复制到输出的2D画布上
API。比使用ctx要快得多。drawImage在Firefox(版本54在OSX Sierra)。
Parameters:
Name | Type | Description |
---|---|---|
sourceContext |
WebGLRenderingContext | 要从中复制的WebGL上下文。 |
targetCanvas |
HTMLCanvasElement | 要复制到的2D目标画布。 |
pipelineState |
Object | 要复制到的2D目标画布。 |
- Source:
findAnimation(cancelFunc) → {AnimationContext|undefined}
Parameters:
Name | Type | Description |
---|---|---|
cancelFunc |
CancelFunction | 由animate返回的函数 |
Returns:
animation's options object
- Type
- AnimationContext | undefined
findAnimationIndex(cancelFunc) → {number}
Parameters:
Name | Type | Description |
---|---|---|
cancelFunc |
CancelFunction | 由animate返回的函数 |
Returns:
- Type
- number
findAnimationsByTarget(target) → {Array.<AnimationContext>}
Parameters:
Name | Type | Description |
---|---|---|
target |
* | 分配给动画上下文的target属性的对象 |
Returns:
array of animation options object associated with target
- Type
- Array.<AnimationContext>
isEmptyStyles(lineIndex) → {Boolean}
如果对象没有样式或一行中没有样式,则返回true
Parameters:
Name | Type | Description |
---|---|---|
lineIndex |
Number | lineIndex在换行行上。 |
- Source:
Returns:
- Type
- Boolean
isEndOfWrapping(lineIndex) → {Boolean}
检测文本行是否以硬分隔符结束
Text和ittext没有换行,返回false
Parameters:
Name | Type | Description |
---|---|---|
lineIndex |
Number | 要分割的文本 |
- Source:
Returns:
- Type
- Boolean
missingNewlineOffset()
检测一行是否有换行,因此我们需要在移动时考虑它
还有计数风格。
- Source:
Returns:
Number
styleHas(lineIndex) → {Boolean}
如果对象具有样式属性或其位于指定行,则返回true
Parameters:
Name | Type | Description |
---|---|---|
lineIndex |
Number |
- Source:
Returns:
- Type
- Boolean
toObject(propertiesToIncludeopt) → {Object}
返回实例的对象表示形式
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
propertiesToInclude |
Array |
<optional> |
您可能希望在输出中额外包含的任何属性 |
- Source:
Returns:
object representation of an instance
- Type
- Object
toObject(propertiesToIncludeopt) → {Object}
返回实例的对象表示形式
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
propertiesToInclude |
Array |
<optional> |
您可能希望在输出中额外包含的任何属性 |
- Source:
Returns:
object representation of an instance
- Type
- Object
Type Definitions
AnimationCurrentState
Type:
- Object
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
options.onChange |
function |
<optional> |
回调;在每次值更改时调用 | |
options.onComplete |
function |
<optional> |
回调;在完成值更改时调用 | |
options.startValue |
Number |
<optional> |
0 | 起始值 |
options.endValue |
Number |
<optional> |
100 | 结束值 |
options.byValue |
Number |
<optional> |
100 | 值来修改属性 |
options.easing |
function |
<optional> |
宽松政策功能 | |
options.duration |
Number |
<optional> |
500 | 变化持续时间(毫秒) |
options.abort |
function |
<optional> |
附加功能与逻辑。如果返回true,动画终止。 | |
currentValue |
number | 范围内的值[' startValue ', ' endValue '] | ||
completionRate |
number | [0,1]范围内的值 | ||
durationRate |
number | [0,1]范围内的值 |