Text
A text label. Leader text is pinned to a point and shows its label at point plus
leader, joined by a leader line when leader isn’t zero. Screen text stays at a fixed
place on the screen. A label pinned to a vertex moves with it when an edit moves the vertex.
Extends
Section titled “Extends”Properties
Section titled “Properties”bounds
Section titled “bounds”
readonlybounds:BoundingBox|null
The element’s bounds in its context’s coordinates, or null when it has no geometry.
A group’s or instance’s bounds enclose its transformed contents and may be a little
larger than they are.
Inherited from
Section titled “Inherited from”entityId
Section titled “entityId”
readonlyentityId:number
Identifier that stays the same for the entity’s lifetime, including across undo and redo.
Inherited from
Section titled “Inherited from”hidden
Section titled “hidden”hidden:
boolean
The element’s own hidden flag; assign inside Model.operation. Hidden ancestors are not taken into account; use Model.isDrawingElementVisible for that.
Inherited from
Section titled “Inherited from”isDeleted
Section titled “isDeleted”
readonlyisDeleted:boolean
Whether the entity was deleted, for example by an edit or by undo.
Inherited from
Section titled “Inherited from”isScreenText
Section titled “isScreenText”
readonlyisScreenText:boolean
Whether this is screen text.
isValid
Section titled “isValid”
readonlyisValid:boolean
Whether the entity still exists in the model.
Inherited from
Section titled “Inherited from”leader
Section titled “leader”
readonlyleader:Vector3d
From the pinned point to the label; the zero vector when the label sits on the point.
readonlypoint:Point3d
The point the label is pinned to, in its context’s coordinates; the origin for screen text.
screenPosition
Section titled “screenPosition”
readonlyscreenPosition: {x:number;y:number; } |null
For screen text, fractions of the view’s width and height from its top-left corner; otherwise null.
readonlytype:"Text"
The concrete class name, for narrowing unions such as AnyElement.
Overrides
Section titled “Overrides”visible
Section titled “visible”visible:
boolean
The inverse of hidden; assign inside Model.operation.
Inherited from
Section titled “Inherited from”Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get color():
Color
The color of the label’s text and leader: red, green, blue and alpha, each from 0 to 1.
Assigning accepts a color without a; the color must be opaque.
Returns
Section titled “Returns”Set Signature
Section titled “Set Signature”set color(
value):void
Parameters
Section titled “Parameters”Color | { a?: number; b: number; g: number; r: number; }
Returns
Section titled “Returns”void
Get Signature
Section titled “Get Signature”get font():
string
The label’s font id: "" for Modlumi’s default face, "source-serif-4" or
"source-code-pro" for the other bundled faces, or "system/<family>/<style>", as in
"system/Arial/Bold", for a face installed on the computer. A label whose face isn’t
installed keeps its font id and shows in the default face.
Returns
Section titled “Returns”string
Set Signature
Section titled “Set Signature”set font(
value):void
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
Get Signature
Section titled “Get Signature”get layer():
Layer|null
The layer the element is on, or null for the default layer; assign inside
Model.operation. A hidden layer hides the element whatever hidden says.
Needs the "layers" feature.
Returns
Section titled “Returns”Layer | null
Set Signature
Section titled “Set Signature”set layer(
value):void
Parameters
Section titled “Parameters”Layer | null
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Get Signature
Section titled “Get Signature”get size():
number
The label’s text size in pixels, from 4 to 400. Labels keep their size on the screen however far away they are. New labels are 14 pixels.
Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set size(
value):void
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Get Signature
Section titled “Get Signature”get text():
string
The label. Assigning an empty string throws.
Returns
Section titled “Returns”string
Set Signature
Section titled “Set Signature”set text(
value):void
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
Methods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON():
object
JSON.stringify writes the entity as its type and entityId, plus its
name when it has one, such as { "type": "Group", "entityId": 12, "name": "Wheel" }.
Returns
Section titled “Returns”object
entityId
Section titled “entityId”entityId:
number
optionalname?:string
type:
"Material"|"Vertex"|"Edge"|"Face"|"Loop"|"EdgeUse"|"Curve"|"ArcCurve"|"ComponentDefinition"|"ComponentInstance"|"Group"|"Layer"|"Guide"|"Text"|"LinearDimension"|"SectionPlane"