new lime.Label(txt)
Display object for text
Parameters:
Name | Type | Description |
---|---|---|
txt |
string | Text contents of the label. |
- Source:
- shape/label.js, line 17
Extends
Summary
Members |
||
---|---|---|
<static> |
defaultFont :string
Default Font name for labels
|
|
id :string
Common name for label objects
|
||
supportedRenderers
|
Inherited
Methods |
||
---|---|---|
<static> |
installFont (name, fileurl, opt_format)
Helper function to install new font file so you can use
the font name as font-family.
|
|
calcWordsArray () → {Array.<string>}
Break text into array of line breakable words
|
||
getAlign () → {string}
Returns alignment value
|
||
getFontColor () → {string}
Returns font color as string
|
||
getFontFamily () → {string}
Returns font used to draw the label
|
||
getFontSize () → {number}
Returns font size in pixels
|
||
getFontWeight () → {string}
Returns font used to draw the label
|
||
getLineHeight () → {number}
Return line height as a factor from font size
|
||
getPadding () → {goog.math.Box}
Return padding box around the text contents
|
||
getShadowBlur () → {number}
Returns shadow blur radius in px.
|
||
getShadowColor () → {string}
Returns shadow color
|
||
getShadowOffset () → {goog.math.Vec2}
Returns shadow offset in px.
|
||
getSize ()
|
||
getStyle () → {string}
Returns the current font style
|
||
getText () → {string}
Returns label text as stirng
|
||
<private> |
hasShadow_ ()
Returns true if the label has a shadow.
|
|
measureText () → {goog.math.Size}
Measure text contents of the label
|
||
setAlign (value) → {lime.Label}
Sets label alignment. Accepts normal strings as left,center,right
|
||
setFontColor (value) → {lime.Label}
Sets the font color. Accepts #hex, rgb(), rgba() or plain color name.
|
||
setFontFamily (value) → {lime.Label}
Set font name
|
||
setFontSize (value) → {lime.Label}
Set the font size in pixels
|
||
setFontWeight (value) → {lime.Label}
Set font weight
|
||
setLineHeight (value, opt_absolute)
Sets the line height used in multiline strings. Can be in pixels
or factor from font size.
|
||
setPadding (top, opt_right, opt_bottom, opt_left) → {lime.Label}
Set new padding box around text contents.
|
||
setShadow (color, opt_blur, opt_offsetX, opt_offsetY) → {lime.Label}
Shorthand for adding shadow to a label. Calling setShadow(null) removes the shadow.
|
||
setShadowBlur (radius)
Set the shadow blur radius.
|
||
setShadowColor (color)
Set the shadow color.
|
||
setShadowOffset (offset, opt_offsetY) → {lime.Label}
Sets label shadow offset in px.
|
||
setStyle (txt) → {lime.Label}
Set label text
|
||
setText (txt) → {lime.Label}
Set label text
|
||
update ()
|
||
wrapText (context, width) → {Array.<string>}
Wrap text on words array to lines based on current
font size and given maximum width.
|
Inherited
lime.Sprite.addEventListener,  lime.Sprite.addTransition,  lime.Sprite.appendChild,  lime.Sprite.calcRelativeQuality,  lime.Sprite.clearTransition,  lime.Sprite.createDomElement,  lime.Sprite.getAnchorPoint,  lime.Sprite.getAutoResize,  lime.Sprite.getBoundingBox,  lime.Sprite.getChildAt,  lime.Sprite.getChildIndex,  lime.Sprite.getCSS3DTransformsAllowed,  lime.Sprite.getDeepestDomElement,  lime.Sprite.getDeepestParentWithDom,  lime.Sprite.getDirector,  lime.Sprite.getDirty,  lime.Sprite.getFill,  lime.Sprite.getFrame,  lime.Sprite.getHidden,  lime.Sprite.getMask,  lime.Sprite.getNumberOfChildren,  lime.Sprite.getOpacity,  lime.Sprite.getParent,  lime.Sprite.getParentStack_,  lime.Sprite.getPosition,  lime.Sprite.getQuality,  lime.Sprite.getRelativeQuality,  lime.Sprite.getRotation,  lime.Sprite.getScale,  lime.Sprite.getScene,  lime.Sprite.getStroke,  lime.Sprite.hitTest,  lime.Sprite.localToNode,  lime.Sprite.localToParent,  lime.Sprite.localToScreen,  lime.Sprite.measureContents,  lime.Sprite.needsDomElement,  lime.Sprite.parentToLocal,  lime.Sprite.removeAllChildren,  lime.Sprite.removeChild,  lime.Sprite.removeChildAt,  lime.Sprite.removeDomElement,  lime.Sprite.removeEventListener,  lime.Sprite.runAction,  lime.Sprite.screenToLocal,  lime.Sprite.setAllow3DCSSTransforms,  lime.Sprite.setAnchorPoint,  lime.Sprite.setAutoResize,  lime.Sprite.setChildIndex,  lime.Sprite.setDirty,  lime.Sprite.setFill,  lime.Sprite.setHidden,  lime.Sprite.setMask,  lime.Sprite.setOpacity,  lime.Sprite.setPosition,  lime.Sprite.setQuality,  lime.Sprite.setRenderer,  lime.Sprite.setRotation,  lime.Sprite.setScale,  lime.Sprite.setSize,  lime.Sprite.setStroke,  lime.Sprite.updateDomElement,  lime.Sprite.updateLayout,  lime.Sprite.wasAddedToTree,  lime.Sprite.wasRemovedFromTree
Members
-
<static> defaultFont :string
-
Default Font name for labels
- Source:
- shape/label.js, line 52
-
id :string
-
Common name for label objects
- Source:
- shape/label.js, line 46
-
supportedRenderers
-
- Source:
- shape/label.js, line 55
Methods
-
<static> installFont(name, fileurl, opt_format)
-
Helper function to install new font file so you can use the font name as font-family.
Parameters:
Name Type Argument Description name
string Font name. fileurl
string Path to font file. opt_format
string <optional>
Font format. - Source:
- shape/label.js, line 581
-
calcWordsArray() → {Array.<string>}
-
Break text into array of line breakable words
- Source:
- shape/label.js, line 407
Returns:
array of words.- Type
- Array.<string>
-
getAlign() → {string}
-
Returns alignment value
- Source:
- shape/label.js, line 280
Returns:
Alignement.- Type
- string
-
getFontColor() → {string}
-
Returns font color as string
- Source:
- shape/label.js, line 204
Returns:
Font color.- Type
- string
-
getFontFamily() → {string}
-
Returns font used to draw the label
- Source:
- shape/label.js, line 147
Returns:
Font name string.- Type
- string
-
getFontSize() → {number}
-
Returns font size in pixels
- Source:
- shape/label.js, line 185
Returns:
Font size in px.- Type
- number
-
getFontWeight() → {string}
-
Returns font used to draw the label
- Source:
- shape/label.js, line 166
Returns:
Font name string.- Type
- string
-
getLineHeight() → {number}
-
Return line height as a factor from font size
- Source:
- shape/label.js, line 270
Returns:
Line height.- Type
- number
-
getPadding() → {goog.math.Box}
-
Return padding box around the text contents
- Source:
- shape/label.js, line 223
Returns:
padding box.- Type
- goog.math.Box
-
getShadowBlur() → {number}
-
Returns shadow blur radius in px.
- Source:
- shape/label.js, line 398
Returns:
shadow blur radius in px.- Type
- number
-
getShadowColor() → {string}
-
Returns shadow color
- Source:
- shape/label.js, line 348
Returns:
shadow color.- Type
- string
-
getShadowOffset() → {goog.math.Vec2}
-
Returns shadow offset in px.
- Source:
- shape/label.js, line 356
Returns:
shadow offset in px.- Type
- goog.math.Vec2
-
getSize()
-
- Source:
- shape/label.js, line 94
-
getStyle() → {string}
-
Returns the current font style
- Source:
- shape/label.js, line 138
Returns:
Style name string.- Type
- string
-
getText() → {string}
-
Returns label text as stirng
- Source:
- shape/label.js, line 106
Returns:
Text contents.- Type
- string
-
<private> hasShadow_()
-
Returns true if the label has a shadow.
- Source:
- shape/label.js, line 340
-
measureText() → {goog.math.Size}
-
Measure text contents of the label
- Source:
- shape/label.js, line 68
Returns:
size of the text.- Type
- goog.math.Size
-
setAlign(value) → {lime.Label}
-
Sets label alignment. Accepts normal strings as left,center,right
Parameters:
Name Type Description value
string New alignment value. - Source:
- shape/label.js, line 289
Returns:
object itself.- Type
- lime.Label
-
setFontColor(value) → {lime.Label}
-
Sets the font color. Accepts #hex, rgb(), rgba() or plain color name.
Parameters:
Name Type Description value
string New color. - Source:
- shape/label.js, line 213
Returns:
object itself.- Type
- lime.Label
-
setFontFamily(value) → {lime.Label}
-
Set font name
Parameters:
Name Type Description value
string New font family string. - Source:
- shape/label.js, line 175
Returns:
object itself.- Type
- lime.Label
-
setFontSize(value) → {lime.Label}
-
Set the font size in pixels
Parameters:
Name Type Description value
number New font size in px. - Source:
- shape/label.js, line 194
Returns:
object itself.- Type
- lime.Label
-
setFontWeight(value) → {lime.Label}
-
Set font weight
Parameters:
Name Type Description value
string New font weight value. - Source:
- shape/label.js, line 156
Returns:
object itself.- Type
- lime.Label
-
setLineHeight(value, opt_absolute)
-
Sets the line height used in multiline strings. Can be in pixels or factor from font size.
Parameters:
Name Type Argument Description value
number Line height. opt_absolute
boolean <optional>
If height is in pixels. - Source:
- shape/label.js, line 260
-
setPadding(top, opt_right, opt_bottom, opt_left) → {lime.Label}
-
Set new padding box around text contents.
Parameters:
Name Type Argument Description top
number Top padding. opt_right
number <optional>
Right padding. opt_bottom
number <optional>
Bottom padding. opt_left
number <optional>
Left padding. - Source:
- shape/label.js, line 235
Returns:
object itself.- Type
- lime.Label
-
setShadow(color, opt_blur, opt_offsetX, opt_offsetY) → {lime.Label}
-
Shorthand for adding shadow to a label. Calling setShadow(null) removes the shadow.
Parameters:
Name Type Argument Description color
string <nullable>
Shadow color. opt_blur
number <optional>
Shadow blur radius. opt_offsetX
number | goog.math.Vec2 <optional>
Shadow offset in X axis, or offset Vec2. opt_offsetY
number <optional>
Shadow offset in Y axis. - Source:
- shape/label.js, line 313
Returns:
object itself.- Type
- lime.Label
-
setShadowBlur(radius)
-
Set the shadow blur radius.
Parameters:
Name Type Description radius
number The shadow blur radius. - Source:
- shape/label.js, line 373
-
setShadowColor(color)
-
Set the shadow color.
Parameters:
Name Type Description color
string The shadow color. - Source:
- shape/label.js, line 364
-
setShadowOffset(offset, opt_offsetY) → {lime.Label}
-
Sets label shadow offset in px.
Parameters:
Name Type Argument Description offset
goog.math.Vec2 | number Shadow offset. opt_offsetY
number <optional>
Optionaly set offset using x,y. - Source:
- shape/label.js, line 384
Returns:
object itself.- Type
- lime.Label
-
setStyle(txt) → {lime.Label}
-
Set label text
Parameters:
Name Type Description txt
string New style contents. - Source:
- shape/label.js, line 127
Returns:
object itself.- Type
- lime.Label
-
setText(txt) → {lime.Label}
-
Set label text
Parameters:
Name Type Description txt
string New text contents. - Source:
- shape/label.js, line 115
Returns:
object itself.- Type
- lime.Label
-
update()
-
- Source:
- shape/label.js, line 469
-
wrapText(context, width) → {Array.<string>}
-
Wrap text on words array to lines based on current font size and given maximum width.
Parameters:
Name Type Description context
Object Canvas2DContext used to measure. width
number Maximum line width. - Source:
- shape/label.js, line 434
Returns:
Lines of text.- Type
- Array.<string>