Global

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.
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
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) → {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
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().
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

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.
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.
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).
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.
Source:

initialize(text, optionsopt) → {fabric.Textbox}

Constructor. Some scaling related property values are forced. Visibility of controls is also fixed; only the rotation and width controls are made available.
Parameters:
Name Type Attributes Description
text String Text string
options Object <optional>
Options object
Source:
Returns:
thisArg
Type
fabric.Textbox

isEndOfWrapping(lineIndex) → {Boolean}

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
Source:
Returns:
Type
Boolean

styleHas(lineIndex) → {Boolean}

Returns true if object has a style property or has it ina specified line
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