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
重写标准Object类值
- 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
重写标准Object类值
文本框需要这个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'属性对文本进行换行。首先这个函数
在换行符上拆分文本,因此保留用户输入的换行符。
然后调用使用Textbox的宽度对每一行进行换行
_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
应用分配给这个图像的过滤器(从过滤器数组)或过滤器参数
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画布的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
检测文本行是否以硬中断结束
文本和文本没有换行,返回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)变更持续时间(单位: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] |