Class TextBlock

A TextBlock is a GraphObject that displays a #text string in a given #font.

Hierarchy

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(): TextBlock

A newly constructed TextBlock has no string to show; if it did, it would draw the text, wrapping if needed, in the default font using a black stroke.

Returns

TextBlock

Properties

public static None: EnumValue

The TextBlock will not wrap its text.

public static WrapDesiredSize: EnumValue

The TextBlock will wrap text and the width of the TextBlock will be the desiredSize's width, if any.

public static WrapFit: EnumValue

The TextBlock will wrap text, making the width of the TextBlock equal to the width of the longest line.

public actionCancel: (e: go.InputEvent, obj: go.GraphObject) => void

Gets or sets the function to execute when the ActionTool is cancelled and this GraphObject's #isActionable is set to true.

public actionDown: (e: go.InputEvent, obj: go.GraphObject) => void

Gets or sets the function to execute on a mouse-down event when this GraphObject's #isActionable is set to true.

public actionMove: (e: go.InputEvent, obj: go.GraphObject) => void

Gets or sets the function to execute on a mouse-move event when this GraphObject's #isActionable is set to true.

public actionUp: (e: go.InputEvent, obj: go.GraphObject) => void

Gets or sets the function to execute on a mouse-up event when this GraphObject's #isActionable is set to true.

public actualBounds: Rect

Gets the bounds of this GraphObject in container coordinates.

public alignment: Spot

Gets or sets the alignment Spot of this GraphObject used in Panel layouts, to determine where in the area allocated by the panel this object should be placed.

public alignmentFocus: Spot

Gets or sets the spot on this GraphObject to be used as the alignment point in Spot and Fixed Panels.

public angle: number

Gets or sets the angle transform, in degrees, of this GraphObject.

public areaBackground: any

Gets or sets the areaBackground Brush (or CSS color string) of this GraphObject.

public background: any

Gets or sets the background Brush (or CSS color string) of this GraphObject, filling the rectangle of this object's local coordinate space.

public click: (e: go.InputEvent, obj: go.GraphObject) => void

Gets or sets the function to execute when the user single-primary-clicks on this object.

public column: number

Gets or sets the column of this GraphObject if it is in a Table Panel.

public columnSpan: number

Gets or sets the number of columns spanned by this GraphObject if it is in a Table Panel.

public contextClick: (e: go.InputEvent, obj: go.GraphObject) => void

Gets or sets the function to execute when the user single-secondary-clicks on this object.

public contextMenu: Adornment

This Adornment is shown upon a context click on this object.

public cursor: string

Gets or sets the mouse cursor to use when the mouse is over this object with no mouse buttons pressed.

public desiredSize: Size

Gets or sets the desired size of this GraphObject in local coordinates.

public diagram: Diagram

Gets the Diagram that this GraphObject is in, if it is.

public doubleClick: (e: go.InputEvent, obj: go.GraphObject) => void

Gets or sets the function to execute when the user double-primary-clicks on this object.

public editable: boolean

Gets or sets whether or not this TextBlock allows in-place editing of the #text string by the user with the help of the TextEditingTool.

public errorFunction: (tool: go.TextEditingTool, oldstr: string, newstr: string) => void

Gets or sets the function to call if a text edit made with the TextEditingTool is invalid.

public font: string

Gets or sets the current font settings.

public fromEndSegmentDirection: EnumValue

Gets or sets how the direction of the last segment of a link coming from this port is computed when the node is rotated.

public fromEndSegmentLength: number

Gets or sets the length of the last segment of a link coming from this port.

public fromLinkable: any

Gets or sets whether the user may draw Links from this port.

public fromLinkableDuplicates: boolean

Gets or sets whether the user may draw duplicate Links from this port.

public fromLinkableSelfNode: boolean

Gets or sets whether the user may draw Links that connect from this port's Node.

public fromMaxLinks: number

Gets or sets the maximum number of links that may come out of this port.

public fromShortLength: number

Gets or sets how far the end segment of a link coming from this port stops short of the actual port.

public fromSpot: Spot

Gets or sets where a link should connect from this port.

public height: number

Gets or sets the desired height of this GraphObject in local coordinates.

public isActionable: boolean

This property determines whether or not this GraphObject's events occur before all other events, including selection.

public isMultiline: boolean

Gets or sets whether or not the text allows or displays multiple lines or embedded newlines.

public isPanelMain: boolean

Gets or sets whether a GraphObject is the "main" object for some types of Panel.

public isStrikethrough: boolean

Gets or sets whether or not the text has a strikethrough line (line-through).

public isUnderline: boolean

Gets or sets whether or not the text is underlined.

public layer: Layer

Gets the GraphObject's containing Layer, if there is any.

public lineCount: number

Gets the total number of lines in this TextBlock, including lines created from returns and wrapping.

public margin: any

Gets or sets the size of empty area around this GraphObject, as a Margin (or number for a uniform Margin), in the containing Panel coordinates.

public maxSize: Size

Gets or sets the maximum size of this GraphObject in container coordinates (either a Panel or the document).

public measuredBounds: Rect

Gets the measuredBounds of the GraphObject in container coordinates (either a Panel or the document).

public minSize: Size

Gets or sets the minimum size of this GraphObject in container coordinates (either a Panel or the document).

public mouseDragEnter: (e: go.InputEvent, obj: go.GraphObject, prev: go.GraphObject) => void

Gets or sets the function to execute when the user moves the mouse into this stationary object during a DraggingTool drag.

public mouseDragLeave: (e: go.InputEvent, obj: go.GraphObject, prev: go.GraphObject) => void

Gets or sets the function to execute when the user moves the mouse out of this stationary object during a DraggingTool drag.

public mouseDrop: (e: go.InputEvent, obj: go.GraphObject) => void

Gets or sets the function to execute when a user drops the selection on this object at the end of a DraggingTool drag.

public mouseEnter: (e: go.InputEvent, obj: go.GraphObject, prev: go.GraphObject) => void

Gets or sets the function to execute when the user moves the mouse into this object without holding down any buttons.

public mouseHold: (e: go.InputEvent, obj: go.GraphObject) => void

Gets or sets the function to execute when the user holds the mouse stationary in the background of the diagram while holding down a button over this object.

public mouseHover: (e: go.InputEvent, obj: go.GraphObject) => void

Gets or sets the function to execute when the user holds the mouse stationary in the background of the diagram without holding down any buttons over this object.

public mouseLeave: (e: go.InputEvent, obj: go.GraphObject, prev: go.GraphObject) => void

Gets or sets the function to execute when the user moves the mouse into this object without holding down any buttons.

public mouseOver: (e: go.InputEvent, obj: go.GraphObject) => void

Gets or sets the function to execute when the user moves the mouse over this object without holding down any buttons.

public name: string

Gets or sets the name for this object.

public naturalBounds: Rect

Gets the natural bounds of this TextBlock in local coordinates, as determined by its #font and #text string.

public panel: Panel

Gets the GraphObject's containing Panel, or null if this object is not in a Panel.

public part: Part

Gets the Part containing this object, if any.

public pickable: boolean

Gets or sets whether or not this GraphObject can be chosen by visual "find" methods such as Diagram#findObjectAt.

public portId: string

Gets or sets an identifier for an object acting as a port on a Node.

public position: Point

Gets or sets the position of this GraphObject in container coordinates (either a Panel or the document).

public row: number

Gets or sets the row of this GraphObject if it is in a Table Panel.

public rowSpan: number

Gets or sets the number of rows spanned by this GraphObject if it is in a Table Panel.

public scale: number

Gets or sets the scale transform of this GraphObject.

public segmentFraction: number

Gets or sets the fractional distance along a segment of a GraphObject that is in a Link.

public segmentIndex: number

Gets or sets the segment index of a GraphObject that is in a Link.

public segmentOffset: Point

Gets or sets the offset of a GraphObject that is in a Link from a point on a segment.

public segmentOrientation: EnumValue

Gets or sets the orientation of a GraphObject that is in a Link.

public stretch: EnumValue

Gets or sets the stretch of the GraphObject.

public stroke: any

Gets or sets the Brush (or CSS color string) that describes the stroke (color) of the #font.

public text: string

Gets or sets the current text string.

public textAlign: string

Gets or sets the current text alignment property.

public textEditor: HTMLElement

Gets or sets the HTMLElement that this TextBlock uses as its text editor in the TextEditingTool.

public textValidation: (tb: go.TextBlock, oldstr: string, newstr: string) => boolean

Gets or sets the predicate that determines whether or not a string of text is valid.

public toEndSegmentDirection: EnumValue

Gets or sets how the direction of the last segment of a link going to this port is computed when the node is rotated.

public toEndSegmentLength: number

Gets or sets the length of the last segment of a link going to this port.

public toLinkable: any

Gets or sets whether the user may draw Links to this port.

public toLinkableDuplicates: boolean

Gets or sets whether the user may draw duplicate Links to this port.

public toLinkableSelfNode: boolean

Gets or sets whether the user may draw Links that connect to this port's Node.

public toMaxLinks: number

Gets or sets the maximum number of links that may go into this port.

public toShortLength: number

Gets or sets how far the end segment of a link going to this port stops short of the actual port.

public toSpot: Spot

Gets or sets where a link should connect to this port.

public toolTip: Adornment

This Adornment is shown when the mouse hovers over this object.

public visible: boolean

Gets or sets whether a GraphObject is visible.

public width: number

Gets or sets the desired width of this GraphObject in local coordinates.

public wrap: EnumValue

Gets or sets whether the text should be wrapped if it is too long to fit on one line.

Methods

public bind(binding: Binding): any

Add a data-binding of a property on this GraphObject to a property on a data object.

Parameters

Returns

any

public copy(): GraphObject

Creates a deep copy of this GraphObject and returns it.

Returns

GraphObject

public getDocumentAngle(): number

Returns the effective angle that the object is drawn at, in document coordinates.

Returns

number

public getDocumentPoint(s: Spot, result?: Point): Point

Returns the Point in document coordinates for a given Spot in this object's bounds.

Parameters

  • s: Spot

    a real Spot describing a location relative to the GraphObject.

  • result?: Point optional

    an optional Point that is modified and returned.

Returns

Point

public getDocumentScale(): number

Returns the total scale that the object is drawn at, in document coordinates.

Returns

number

public getLocalPoint(p: Point, result?: Point): Point

Given a Point in document coordinates, returns a new Point in local coordinates.

Parameters

  • p: Point

    a Point in document coordinates.

  • result?: Point optional

    an optional Point that is modified and returned.

Returns

Point

public isContainedBy(panel: GraphObject): boolean

This predicate is true if this object is an element, perhaps indirectly, of the given panel.

Parameters

  • panel: GraphObject

    or if it is contained by another panel that is contained by the given panel, to any depth; false if the argument is null or is not a Panel.

Returns

boolean

public isVisibleObject(): boolean

This predicate is true if this object is #visible and each of its visual containing panels are also visible.

Returns

boolean