Extends mxShape to implement a text shape. To change vertical text from bottom to top to top to bottom, the following code can be used:
mxText.prototype.ieVerticalFilter = 'progid:DXImageTransform.Microsoft.BasicImage(rotation=1)'; mxText.prototype.verticalTextDegree = 90; mxText.prototype.getVerticalOffset = function(offset) { return new mxPoint(-offset.y, offset.x); };
mxText | Extends mxShape to implement a text shape. |
Functions | |
mxText | Constructs a new text shape. |
Variables | |
replaceLinefeeds | Specifies if linefeeds in HTML labels should be replaced with BR tags. |
ieVerticalFilter | Holds the filter definition for vertical text in IE. |
verticalTextDegree | Specifies the degree to be used for vertical text. |
forceIgnoreStringSize | Specifies if the string size should always be ignored. |
Functions | |
isStyleSet | Returns true if the given font style (bold, italic etc) is true in this shape’s fontStyle. |
create | Override to create HTML regardless of gradient and rounded property. |
createForeignObject | Creates and returns the foreignObject node to represent this shape. |
createHtml | Creates and returns the HTML node to represent this shape. |
createVml | Creates and returns the VML node(s) to represent this shape. |
redrawHtml | Updates the HTML node(s) to reflect the latest bounds and scale. |
getOffset | Returns the description of the space between the <bounds> size and the label size as an mxPoint. |
getSpacing | Returns the spacing as an mxPoint. |
createHtmlTable | Creates and returns a HTML table with a table body and a single row with a single cell. |
updateTableStyle | Updates the style of the given HTML table and the value within the table. |
getTableSize | Returns the actual size of the table. |
updateTableWidth | Updates the width of the given HTML table. |
redrawVml | Updates the VML node(s) to reflect the latest bounds and scale. |
redrawTextbox | Redraws the textbox for this text. |
redrawHtmlTable | Redraws the HTML table. |
getVerticalOffset | Returns the factors for the offset to be added to the text vertical text rotation. |
redrawForeignObject | Redraws the foreign object for this text. |
createSvg | Creates and returns the SVG node(s) to represent this shape. |
redrawSvg | Updates the SVG node(s) to reflect the latest bounds and scale. |
redrawSvgTextNodes | Hook to update the position of the SVG text nodes. |
releaseSvgClip | Releases the given SVG clip removing it from the DOM if required. |
getSvgClip | Returns a new or existing SVG clip path which is a descendant of the given SVG node with a unique ID. |
isEmptyString | Returns true if the given string is empty or contains only whitespace. |
createSvgSpan | Creats an SVG tspan node for the given text. |
destroy | Extends destroy to remove any allocated SVG clips. |
function mxText( value, bounds, align, valign, color, family, size, fontStyle, spacing, spacingTop, spacingRight, spacingBottom, spacingLeft, horizontal, background, border, wrap, clipped, overflow, labelPadding )
Constructs a new text shape.
value | String that represents the text to be displayed. This is stored in <value>. |
bounds | mxRectangle that defines the bounds. This is stored in mxShape.bounds. |
align | Specifies the horizontal alignment. Default is ‘’. This is stored in <align>. |
valign | Specifies the vertical alignment. Default is ‘’. This is stored in <valign>. |
color | String that specifies the text color. Default is ‘black’. This is stored in <color>. |
family | String that specifies the font family. Default is mxConstants.DEFAULT_FONTFAMILY. This is stored in <family>. |
size | Integer that specifies the font size. Default is mxConstants.DEFAULT_FONTSIZE. This is stored in <size>. |
fontStyle | Specifies the font style. Default is 0. This is stored in <fontStyle>. |
spacing | Integer that specifies the global spacing. Default is 2. This is stored in <spacing>. |
spacingTop | Integer that specifies the top spacing. Default is 0. The sum of the spacing and this is stored in <spacingTop>. |
spacingRight | Integer that specifies the right spacing. Default is 0. The sum of the spacing and this is stored in <spacingRight>. |
spacingBottom | Integer that specifies the bottom spacing. Default is 0.The sum of the spacing and this is stored in <spacingBottom>. |
spacingLeft | Integer that specifies the left spacing. Default is 0. The sum of the spacing and this is stored in <spacingLeft>. |
horizontal | Boolean that specifies if the label is horizontal. Default is true. This is stored in <horizontal>. |
background | String that specifies the background color. Default is null. This is stored in <background>. |
border | String that specifies the label border color. Default is null. This is stored in <border>. |
wrap | Specifies if word-wrapping should be enabled. Default is false. This is stored in <wrap>. |
clipped | Specifies if the label should be clipped. Default is false. This is stored in <clipped>. |
overflow | Value of the overflow style. Default is ‘visible’. |
mxText.prototype.replaceLinefeeds
Specifies if linefeeds in HTML labels should be replaced with BR tags. Default is true. This is also used in mxImageExport to export the label.
mxText.prototype.forceIgnoreStringSize
Specifies if the string size should always be ignored. Default is false. This can be used to improve rendering speed in slow browsers. This can be used if all labels are smaller than the vertex width. String sizes are ignored by default for labels which are left aligned with no background and border or if the overflow is set to fill.
mxText.prototype.isStyleSet = function( style )
Returns true if the given font style (bold, italic etc) is true in this shape’s fontStyle.
style | Fontstyle constant from mxConstants. |
mxText.prototype.getOffset = function( outerWidth, outerHeight, actualWidth, actualHeight, horizontal )
Returns the description of the space between the <bounds> size and the label size as an mxPoint.
mxText.prototype.getSpacing = function( horizontal )
Returns the spacing as an mxPoint.
Constructs a new text shape.
function mxText( value, bounds, align, valign, color, family, size, fontStyle, spacing, spacingTop, spacingRight, spacingBottom, spacingLeft, horizontal, background, border, wrap, clipped, overflow, labelPadding )
Specifies if linefeeds in HTML labels should be replaced with BR tags.
mxText.prototype.replaceLinefeeds
Holds the filter definition for vertical text in IE.
mxText.prototype.ieVerticalFilter
Specifies the degree to be used for vertical text.
mxText.prototype.verticalTextDegree
Specifies if the string size should always be ignored.
mxText.prototype.forceIgnoreStringSize
Returns true if the given font style (bold, italic etc) is true in this shape’s fontStyle.
mxText.prototype.isStyleSet = function( style )
Override to create HTML regardless of gradient and rounded property.
mxText.prototype.create = function( container )
Creates and returns the foreignObject node to represent this shape.
mxText.prototype.createForeignObject = function()
Creates and returns the HTML node to represent this shape.
mxText.prototype.createHtml = function()
Creates and returns the VML node(s) to represent this shape.
mxText.prototype.createVml = function()
Updates the HTML node(s) to reflect the latest bounds and scale.
mxText.prototype.redrawHtml = function()
Returns the description of the space between the bounds size and the label size as an mxPoint.
mxText.prototype.getOffset = function( outerWidth, outerHeight, actualWidth, actualHeight, horizontal )
Returns the spacing as an mxPoint.
mxText.prototype.getSpacing = function( horizontal )
Creates and returns a HTML table with a table body and a single row with a single cell.
mxText.prototype.createHtmlTable = function()
Returns the actual size of the table.
mxText.prototype.getTableSize = function( table )
Updates the width of the given HTML table.
mxText.prototype.updateTableWidth = function( table )
Updates the VML node(s) to reflect the latest bounds and scale.
mxText.prototype.redrawVml = function()
Redraws the textbox for this text.
mxText.prototype.redrawTextbox = function()
Redraws the HTML table.
mxText.prototype.redrawHtmlTable = function()
Returns the factors for the offset to be added to the text vertical text rotation.
mxText.prototype.getVerticalOffset = function( offset )
Redraws the foreign object for this text.
mxText.prototype.redrawForeignObject = function()
Creates and returns the SVG node(s) to represent this shape.
mxText.prototype.createSvg = function()
Updates the SVG node(s) to reflect the latest bounds and scale.
mxText.prototype.redrawSvg = function()
Hook to update the position of the SVG text nodes.
mxText.prototype.redrawSvgTextNodes = function( x, y, dy )
Releases the given SVG clip removing it from the DOM if required.
mxText.prototype.releaseSvgClip = function()
Returns a new or existing SVG clip path which is a descendant of the given SVG node with a unique ID.
mxText.prototype.getSvgClip = function( svg, x, y, w, h )
Returns true if the given string is empty or contains only whitespace.
mxText.prototype.isEmptyString = function( text )
Creats an SVG tspan node for the given text.
mxText.prototype.createSvgSpan = function( text )
Extends destroy to remove any allocated SVG clips.
mxText.prototype.destroy = function()
Holds the mxRectangle that specifies the bounds of this shape.
mxShape.prototype.bounds