new Caption(viewer, options, meta)
Create a new Caption.
Name | Type | Description |
---|---|---|
viewer |
Viewer |
The viewer. |
options |
Object |
Attributes used to create the caption. |
meta |
Object |
optional
User-defined Meta data to add to the caption. |
Extends
Members
-
anchorString
-
Get or set the caption anchor position.
-
backgroundColorColor
-
Get or set the backgroundColor. When setting the color, a string representing the color or a
Color
object can be used. For details seeColor
. -
canvasCanvas
-
Get the canvas.
-
fontFont
-
Get or set the font. When setting the font, a string representing the font or a
Font
object can be used. For details seeFont
. -
fontColorColor
-
Get or set the fontColor. When setting the color, a string representing the color or a
Color
object can be used. For details seeColor
. -
layoutLayout
-
Get the layout.
-
metaBoolean
-
Get or Set the meta data of this object. See the meta data tutorial for details.
-
nameString
-
Get or set the text shown for this caption.
-
onString
-
Get or set where the caption will be relative to. Values: 'map', 'canvas'
-
onCanvasBoolean
-
Returns true if the caption is positioned on the canvas
-
onMapBoolean
-
Returns true if the caption is positioned on the map
-
positionString
-
Get or set the caption position.
-
sequenceSequence
-
Get the sequence.
-
textAlignmentString
-
Get or set the text alignment. Possible values are left, center, or right.
-
viewerViewer
-
Get or set the Viewer
-
visibleBoolean
-
Get or Set the visibility of this object.
Methods
-
clear()
-
Clear the box containing this caption.
-
inherited deleteFromObjects()
-
Remove the object from Viewer.objects
-
draw()
-
Draw the caption
-
highlight(color)
-
Highlight the caption by drawing a box around it.
Name Type Description color
Color Color of the highlighting outline
-
invertColors()
-
Invert the colors of the caption (i.e. backgroundColor and fontColor).
-
move(newIndex)
-
Move this caption to a new index in the array of Viewer captions.
Name Type Description newIndex
Number New index for this caption (0-based)
-
moveTo(duration)
-
Move the map to center the caption. Only works with caption positioned on the map (not the canvas).
Name Type Default Description duration
Number 1000 Duration of move animation
-
remove()
-
Remove caption
-
toJSON()
-
Returns JSON representing the object
-
toString(){String}
-
Return the class name as a string.
Returns:
Type Description String - 'Caption'
-
update(attributes)
-
Update caption attributes. See updating records for details.
Name Type Description attributes
Object Object describing the properties to change