Members
__cachedLines :Array
- Source:
Cached array of text wrapping.
Type:
- Array
dynamicMinWidth :Number
- Source:
- Default Value:
- 2
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.
Type:
- Number
lockScalingFlip
- Source:
Override standard Object class values
minWidth :Number
- Source:
- Default Value:
- 20
Minimum width of textbox, in pixels.
Type:
- Number
noScaleCache
- Source:
Override standard Object class values
Textbox needs this on false
splitByGrapheme :Boolean
- Source:
- Since:
- 2.6.0
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
type :String
- Source:
- Default Value:
- textbox
Type of an object
Type:
- String
Methods
_splitTextIntoLines(text) → {Array}
- Source:
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 |
Returns:
Array of lines in the Textbox.
- Type
- Array
_wrapLine(line, lineIndex, desiredWidth, reservedSpace) → {Array}
- Source:
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 |
Returns:
Array of line(s) into which the given text is wrapped
to.
- Type
- Array
_wrapText(lines, desiredWidth) → {Array}
- Source:
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().
Parameters:
Name | Type | Description |
---|---|---|
lines |
Array | The string array of text that is split into lines |
desiredWidth |
Number | width you want to wrap to |
Returns:
Array of lines
- Type
- Array
applyFilters(filters, forResizing) → {thisArg}
- Source:
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 |
Returns:
return the fabric.Image object
- Type
- thisArg
copyGLTo2DDrawImage(sourceContext, targetCanvas, pipelineState)
- Source:
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.
Parameters:
Name | Type | Description |
---|---|---|
sourceContext |
WebGLRenderingContext | The WebGL context to copy from. |
targetCanvas |
HTMLCanvasElement | The 2D target canvas to copy on to. |
pipelineState |
Object | The 2D target canvas to copy on to. |
copyGLTo2DPutImageData(sourceContext, targetCanvas, pipelineState)
- Source:
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).
Parameters:
Name | Type | Description |
---|---|---|
sourceContext |
WebGLRenderingContext | The WebGL context to copy from. |
targetCanvas |
HTMLCanvasElement | The 2D target canvas to copy on to. |
pipelineState |
Object | The 2D target canvas to copy on to. |
isEmptyStyles(lineIndex) → {Boolean}
- Source:
Returns true if object has no styling or no styling in a line
Parameters:
Name | Type | Description |
---|---|---|
lineIndex |
Number | , lineIndex is on wrapped lines. |
Returns:
- Type
- Boolean
isEndOfWrapping(lineIndex) → {Boolean}
- Source:
Detect if the text line is ended with an hard break
text and itext do not have wrapping, return false
Parameters:
Name | Type | Description |
---|---|---|
lineIndex |
Number | text to split |
Returns:
- Type
- Boolean
missingNewlineOffset()
- Source:
Detect if a line has a linebreak and so we need to account for it when moving
and counting style.
Returns:
Number
styleHas(lineIndex) → {Boolean}
- Source:
Returns true if object has a style property or has it on a specified line
Parameters:
Name | Type | Description |
---|---|---|
lineIndex |
Number |
Returns:
- Type
- Boolean
toObject(propertiesToIncludeopt) → {Object}
- Source:
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 |
Returns:
object representation of an instance
- Type
- Object
toObject(propertiesToIncludeopt) → {Object}
- Source:
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 |
Returns:
object representation of an instance
- Type
- Object