Members
__cachedLines :Array
Cached array of text wrapping.
缓存的文本换行数组。
Type:
- Array
- Source:
dynamicMinWidth :Number
Minimum calculated width of a textbox, in pixels.
fixed to 2 so that an empty textbox cannot go to 0
and is still selectable without text.
文本框的最小计算宽度,以像素为单位。
修正为2,使空文本框不能变为0
并且在没有文本的情况下仍然可以选择。
Type:
- Number
- Default Value:
- 2
- Source:
lockScalingFlip
Override standard Object class values
覆盖标准对象类值
- Source:
minWidth :Number
Minimum width of textbox, in pixels.
文本框的最小宽度,以像素为单位。
Type:
- Number
- Default Value:
- 20
- Source:
noScaleCache
Override standard Object class values
Textbox needs this on false
覆盖标准对象类值
文本框需要设置为false
- Source:
splitByGrapheme :Boolean
Use this boolean property in order to split strings that have no white space concept.
this is a cheap way to help with chinese/japanese
使用这个布尔属性来分割没有空白概念的字符串。
这是一种帮助学习中文/日语的廉价方法
Type:
- Boolean
- Since:
- 2.6.0
- Source:
type :String
Type of an object
对象的类型
Type:
- String
- Default Value:
- textbox
- Source:
Methods
_splitTextIntoLines(text) → {Array}
Gets lines of text to render in the Textbox. This function calculates
text wrapping on the fly every time it is called.
获取要在文本框中呈现的文本行。这个函数计算
每次调用时动态地进行文本换行。
Parameters:
Name | Type | Description |
---|---|---|
text |
String | text to split要分割的文本 |
- Source:
Returns:
Array of lines in the Textbox.
- Type
- Array
_wrapLine(line, lineIndex, desiredWidth, reservedSpace) → {Array}
Wraps a line of text using the width of the Textbox and a context.
使用文本框和上下文的宽度换行文本行。
Parameters:
Name | Type | Description |
---|---|---|
line |
Array | The grapheme array that represent the line表示行的字形数组 |
lineIndex |
Number | |
desiredWidth |
Number | width you want to wrap the line to想要换行的宽度 |
reservedSpace |
Number | space to remove from wrapping for custom functionalities要从自定义功能的包装中删除的空间 |
- Source:
Returns:
Array of line(s) into which the given text is wrapped
to.
- Type
- Array
_wrapText(lines, desiredWidth) → {Array}
Wraps text using the 'width' property of Textbox. First this function
splits text on newlines, so we preserve newlines entered by the user.
Then it wraps each line using the width of the Textbox by calling
_wrapLine().
使用Textbox的'width'属性换行文本。首先这个函数
按换行拆分文本,因此我们保留用户输入的换行符。
然后使用文本框的宽度对每行行进行换行
_wrapLine()。
Parameters:
Name | Type | Description |
---|---|---|
lines |
Array | The string array of text that is split into lines分割成行的文本字符串数组 |
desiredWidth |
Number | width you want to wrap to想要换行的宽度 |
- Source:
Returns:
Array of lines
- Type
- Array
applyFilters(filters, forResizing) → {thisArg}
Applies filters assigned to this image (from "filters" array) or from filter param
应用分配给该图像的过滤器(来自“filters”数组)或过滤器参数
Parameters:
Name | Type | Description |
---|---|---|
filters |
Array | to be applied待应用 |
forResizing |
Boolean | specify if the filter operation is a resize operation指定过滤器操作是否为调整大小操作 |
- Source:
Returns:
return the fabric.Image object
- Type
- thisArg
cancelAll() → {Array.<AnimationContext>}
cancel all running animations at the next requestAnimFrame
在下一个requestAnimFrame时取消所有正在运行的动画
Returns:
- Type
- Array.<AnimationContext>
cancelByCanvas(canvas) → {Array.<AnimationContext>}
cancel all running animations attached to canvas at the next requestAnimFrame
在下一个requestAnimFrame时取消画布上所有正在运行的动画
Parameters:
Name | Type | Description |
---|---|---|
canvas |
fabric.Canvas |
Returns:
- Type
- Array.<AnimationContext>
cancelByTarget(target) → {Array.<AnimationContext>}
cancel all running animations for target at the next requestAnimFrame
在下一个requestAnimFrame时取消所有正在运行的动画
Parameters:
Name | Type | Description |
---|---|---|
target |
* |
Returns:
- Type
- Array.<AnimationContext>
copyGLTo2DDrawImage(sourceContext, targetCanvas, pipelineState)
Copy an input WebGL canvas on to an output 2D canvas.
The WebGL canvas is assumed to be upside down, with the top-left pixel of the
desired output image appearing in the bottom-left corner of the WebGL canvas.
将输入WebGL画布复制到输出2D画布上。
WebGL画布被假设为上下颠倒,左上角像素为
所需的输出图像出现在WebGL画布的左下角。
Parameters:
Name | Type | Description |
---|---|---|
sourceContext |
WebGLRenderingContext | The WebGL context to copy from.要从中复制的WebGL上下文。 |
targetCanvas |
HTMLCanvasElement | The 2D target canvas to copy on to.要复制到的2D目标画布。 |
pipelineState |
Object | The 2D target canvas to copy on to.要复制到的2D目标画布。 |
- Source:
copyGLTo2DPutImageData(sourceContext, targetCanvas, pipelineState)
Copy an input WebGL canvas on to an output 2D canvas using 2d canvas' putImageData
API. Measurably faster than using ctx.drawImage in Firefox (version 54 on OSX Sierra).
使用2D canvas的putImageData将输入的WebGL画布复制到输出的2D画布上
API。比使用ctx要快得多。drawImage在Firefox(版本54在OSX Sierra)。
Parameters:
Name | Type | Description |
---|---|---|
sourceContext |
WebGLRenderingContext | The WebGL context to copy from.要从中复制的WebGL上下文。 |
targetCanvas |
HTMLCanvasElement | The 2D target canvas to copy on to.要复制到的2D目标画布。 |
pipelineState |
Object | The 2D target canvas to copy on to.要复制到的2D目标画布。 |
- Source:
findAnimation(cancelFunc) → {AnimationContext|undefined}
Parameters:
Name | Type | Description |
---|---|---|
cancelFunc |
CancelFunction | the function returned by animate由animate返回的函数 |
Returns:
animation's options object
- Type
- AnimationContext | undefined
findAnimationIndex(cancelFunc) → {number}
Parameters:
Name | Type | Description |
---|---|---|
cancelFunc |
CancelFunction | the function returned by animate由animate返回的函数 |
Returns:
- Type
- number
findAnimationsByTarget(target) → {Array.<AnimationContext>}
Parameters:
Name | Type | Description |
---|---|---|
target |
* | the object that is assigned to the target property of the animation context分配给动画上下文的target属性的对象 |
Returns:
array of animation options object associated with target
- Type
- Array.<AnimationContext>
isEmptyStyles(lineIndex) → {Boolean}
Returns true if object has no styling or no styling in a line
如果对象没有样式或一行中没有样式,则返回true
Parameters:
Name | Type | Description |
---|---|---|
lineIndex |
Number | , lineIndex is on wrapped lines.lineIndex在换行行上。 |
- Source:
Returns:
- Type
- Boolean
isEndOfWrapping(lineIndex) → {Boolean}
Detect if the text line is ended with an hard break
text and itext do not have wrapping, return false
检测文本行是否以硬分隔符结束
Text和ittext没有换行,返回false
Parameters:
Name | Type | Description |
---|---|---|
lineIndex |
Number | text to split要分割的文本 |
- Source:
Returns:
- Type
- Boolean
missingNewlineOffset()
Detect if a line has a linebreak and so we need to account for it when moving
and counting style.
检测一行是否有换行,因此我们需要在移动时考虑它
还有计数风格。
- Source:
Returns:
Number
styleHas(lineIndex) → {Boolean}
Returns true if object has a style property or has it on a specified line
如果对象具有样式属性或其位于指定行,则返回true
Parameters:
Name | Type | Description |
---|---|---|
lineIndex |
Number |
- Source:
Returns:
- Type
- Boolean
toObject(propertiesToIncludeopt) → {Object}
Returns object representation of an instance
返回实例的对象表示形式
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
propertiesToInclude |
Array |
<optional> |
Any properties that you might want to additionally include in the output您可能希望在输出中额外包含的任何属性 |
- Source:
Returns:
object representation of an instance
- Type
- Object
toObject(propertiesToIncludeopt) → {Object}
Returns object representation of an instance
返回实例的对象表示形式
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
propertiesToInclude |
Array |
<optional> |
Any properties that you might want to additionally include in the output您可能希望在输出中额外包含的任何属性 |
- Source:
Returns:
object representation of an instance
- Type
- Object
Type Definitions
AnimationCurrentState
Type:
- Object
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
options.onChange |
function |
<optional> |
Callback; invoked on every value change回调;在每次值更改时调用 | |
options.onComplete |
function |
<optional> |
Callback; invoked when value change is completed回调;在完成值更改时调用 | |
options.startValue |
Number |
<optional> |
0 | Starting value起始值 |
options.endValue |
Number |
<optional> |
100 | Ending value结束值 |
options.byValue |
Number |
<optional> |
100 | Value to modify the property by值来修改属性 |
options.easing |
function |
<optional> |
Easing function宽松政策功能 | |
options.duration |
Number |
<optional> |
500 | Duration of change (in ms)变化持续时间(毫秒) |
options.abort |
function |
<optional> |
Additional function with logic. If returns true, animation aborts.附加功能与逻辑。如果返回true,动画终止。 | |
currentValue |
number | value in range [`startValue`, `endValue`]范围内的值[' startValue ', ' endValue '] | ||
completionRate |
number | value in range [0, 1][0,1]范围内的值 | ||
durationRate |
number | value in range [0, 1][0,1]范围内的值 |