Ir al contenido

TextBlock

Defined in: panel/TextBlock.ts:28

A text element in a panel.

new TextBlock(text?): TextBlock

Defined in: panel/TextBlock.ts:44

string

TextBlock

GraphObject.constructor

optional actionCancel?: (e, obj) => void

Defined in: panel/GraphObject.ts:86

InputEvent

GraphObject

void

GraphObject.actionCancel


optional actionDown?: (e, obj) => void

Defined in: panel/GraphObject.ts:83

InputEvent

GraphObject

void

GraphObject.actionDown


optional actionMove?: (e, obj) => void

Defined in: panel/GraphObject.ts:84

InputEvent

GraphObject

void

GraphObject.actionMove


optional actionUp?: (e, obj) => void

Defined in: panel/GraphObject.ts:85

InputEvent

GraphObject

void

GraphObject.actionUp


optional click?: (e, obj) => void

Defined in: panel/GraphObject.ts:68

InputEvent

GraphObject

void

GraphObject.click


optional contextClick?: (e, obj) => void

Defined in: panel/GraphObject.ts:70

InputEvent

GraphObject

void

GraphObject.contextClick


optional doubleClick?: (e, obj) => void

Defined in: panel/GraphObject.ts:69

InputEvent

GraphObject

void

GraphObject.doubleClick


isActionable: boolean = false

Defined in: panel/GraphObject.ts:82

GoJS-compatible: when true, ActionTool dispatches actionDown/actionMove/actionUp/actionCancel on this object for mouse-down-move-up gestures starting on it — for building controls (buttons, sliders) that handle their own gesture without a new Tool.

GraphObject.isActionable


optional mouseEnter?: (e, obj, prev) => void

Defined in: panel/GraphObject.ts:71

InputEvent

GraphObject

GraphObject | null

void

GraphObject.mouseEnter


optional mouseLeave?: (e, obj, prev) => void

Defined in: panel/GraphObject.ts:72

InputEvent

GraphObject

GraphObject | null

void

GraphObject.mouseLeave


optional mouseOut?: (e, obj) => void

Defined in: panel/GraphObject.ts:74

InputEvent

GraphObject

void

GraphObject.mouseOut


optional mouseOver?: (e, obj) => void

Defined in: panel/GraphObject.ts:73

InputEvent

GraphObject

void

GraphObject.mouseOver


parentPanel: GraphObject | null = null

Defined in: panel/GraphObject.ts:89

The panel this object belongs to (set when added). Used for ofObject resolution.

GraphObject.parentPanel


portId: string = ''

Defined in: panel/GraphObject.ts:92

GoJS-compatible: If non-empty, this object acts as a port on its part.

GraphObject.portId


readonly static OverflowClip: "clip" = 'clip'

Defined in: panel/TextBlock.ts:30

GoJS-compatible: named constant for overflow — clips overflowing text with no ellipsis.


readonly static OverflowEllipsis: "ellipsis" = 'ellipsis'

Defined in: panel/TextBlock.ts:32

GoJS-compatible: named constant for overflow — truncates overflowing text with an ellipsis (“…”).

get actualSize(): Size

Defined in: panel/GraphObject.ts:481

The actual size computed during layout.

Size

GraphObject.actualSize


get alignment(): Spot | null

Defined in: panel/GraphObject.ts:491

The alignment spot for Spot panels.

Spot | null

set alignment(value): void

Defined in: panel/GraphObject.ts:495

Spot | null

void

Placeholder.alignment


get alignmentFocus(): Spot | null

Defined in: panel/GraphObject.ts:553

GoJS-compatible: The spot within this object used for alignment/placement.

Spot | null

set alignmentFocus(value): void

Defined in: panel/GraphObject.ts:557

Spot | null

void

GraphObject.alignmentFocus


get angle(): number

Defined in: panel/GraphObject.ts:414

The rotation angle in degrees.

number

set angle(value): void

Defined in: panel/GraphObject.ts:418

number

void

GraphObject.angle


get bindings(): readonly Binding[]

Defined in: panel/GraphObject.ts:104

GoJS-compatible: The bindings attached to this graph object.

readonly Binding[]

GraphObject.bindings


get color(): string

Defined in: panel/TextBlock.ts:57

string

set color(value): void

Defined in: panel/TextBlock.ts:61

string

void


get column(): number

Defined in: panel/GraphObject.ts:524

GoJS-compatible: The column index for table panels.

number

set column(value): void

Defined in: panel/GraphObject.ts:528

number

void

GraphObject.column


get columnSpan(): number

Defined in: panel/GraphObject.ts:542

GoJS-compatible: The number of columns this object spans.

number

set columnSpan(value): void

Defined in: panel/GraphObject.ts:546

number

void

GraphObject.columnSpan


get copyable(): boolean

Defined in: panel/GraphObject.ts:635

GoJS-compatible: Whether this object is included when copying its part.

boolean

set copyable(value): void

Defined in: panel/GraphObject.ts:639

boolean

void

GraphObject.copyable


get cursor(): string

Defined in: panel/GraphObject.ts:423

GoJS-compatible: The cursor displayed when hovering over this object.

string

set cursor(value): void

Defined in: panel/GraphObject.ts:427

string

void

Placeholder.cursor


get desiredSize(): Size | null

Defined in: panel/GraphObject.ts:432

The desired size. If null, natural size is used.

Size | null

set desiredSize(value): void

Defined in: panel/GraphObject.ts:436

Size | null

void

GraphObject.desiredSize


get editable(): boolean

Defined in: panel/TextBlock.ts:84

GoJS-compatible: Whether this text can be edited in-place by the user.

boolean

set editable(value): void

Defined in: panel/TextBlock.ts:88

boolean

void


get font(): string

Defined in: panel/TextBlock.ts:110

string

set font(value): void

Defined in: panel/TextBlock.ts:114

string

void


get fontFamily(): string

Defined in: panel/TextBlock.ts:119

GoJS-compatible: The font family (e.g. “sans-serif”).

string

set fontFamily(value): void

Defined in: panel/TextBlock.ts:124

string

void


get fontSize(): number

Defined in: panel/TextBlock.ts:129

GoJS-compatible: The font size in points (px).

number

set fontSize(value): void

Defined in: panel/TextBlock.ts:134

number

void


get fontStyle(): string

Defined in: panel/TextBlock.ts:139

GoJS-compatible: The font style (e.g. “bold”, “italic”).

string

set fontStyle(value): void

Defined in: panel/TextBlock.ts:144

string

void


get height(): number

Defined in: panel/GraphObject.ts:462

GoJS-compatible: the last explicitly-set desired height, or NaN if never set.

number

set height(value): void

Defined in: panel/GraphObject.ts:466

number

void

Placeholder.height


get isBold(): boolean

Defined in: panel/TextBlock.ts:150

GoJS-compatible: Whether the text is bold.

boolean

set isBold(value): void

Defined in: panel/TextBlock.ts:154

boolean

void


get isItalic(): boolean

Defined in: panel/TextBlock.ts:162

GoJS-compatible: Whether the text is italic.

boolean

set isItalic(value): void

Defined in: panel/TextBlock.ts:166

boolean

void


get isMultiline(): boolean

Defined in: panel/TextBlock.ts:93

GoJS-compatible: Whether the text can wrap to multiple lines.

boolean

set isMultiline(value): void

Defined in: panel/TextBlock.ts:97

boolean

void


get isShadowed(): boolean

Defined in: panel/GraphObject.ts:578

GoJS-compatible: Whether this object casts a drop shadow.

boolean

set isShadowed(value): void

Defined in: panel/GraphObject.ts:582

boolean

void

GraphObject.isShadowed


get isUnderline(): boolean

Defined in: panel/TextBlock.ts:176

GoJS-compatible: Whether the text is underlined.

boolean

set isUnderline(value): void

Defined in: panel/TextBlock.ts:180

boolean

void


get isVisibleObject(): boolean

Defined in: panel/GraphObject.ts:379

GoJS-compatible: Whether this object and all of its ancestors are visible.

boolean

GraphObject.isVisibleObject


get margin(): Margin | null

Defined in: panel/GraphObject.ts:500

The margin around this object.

Margin | null

set margin(value): void

Defined in: panel/GraphObject.ts:505

GoJS-compatible: a plain number sets a uniform margin on all four sides.

number | Margin | null

void

GraphObject.margin


get maxLines(): number

Defined in: panel/TextBlock.ts:198

GoJS-compatible: The maximum number of lines of text.

number

set maxLines(value): void

Defined in: panel/TextBlock.ts:202

number

void


get multiline(): boolean

Defined in: panel/TextBlock.ts:214

boolean

set multiline(value): void

Defined in: panel/TextBlock.ts:218

boolean

void


get name(): string

Defined in: panel/GraphObject.ts:95

The name of this graph object, used for findObject() lookups.

string

set name(value): void

Defined in: panel/GraphObject.ts:99

string

void

Placeholder.name


get opacity(): number

Defined in: panel/GraphObject.ts:405

The opacity of this object (0-1).

number

set opacity(value): void

Defined in: panel/GraphObject.ts:409

number

void

GraphObject.opacity


get overflow(): string

Defined in: panel/TextBlock.ts:187

GoJS-compatible: How overflowing text is handled (“visible”, “hidden”, “ellipsis”, “clip”).

string

set overflow(value): void

Defined in: panel/TextBlock.ts:191

string

void


get parent(): GraphObject | null

Defined in: panel/GraphObject.ts:389

GoJS-compatible: The parent panel of this object (or null).

GraphObject | null

GraphObject.parent


get part(): Part | null

Defined in: panel/GraphObject.ts:394

GoJS-compatible: The Part that contains this object (or null).

Part | null

GraphObject.part


get pickable(): boolean

Defined in: panel/GraphObject.ts:626

GoJS-compatible: Whether this object can be hit-tested.

boolean

set pickable(value): void

Defined in: panel/GraphObject.ts:630

boolean

void

GraphObject.pickable


get position(): object

Defined in: panel/GraphObject.ts:471

The position within the parent panel.

object

x: number

y: number

GraphObject.position


get row(): number

Defined in: panel/GraphObject.ts:515

GoJS-compatible: The row index for table panels.

number

set row(value): void

Defined in: panel/GraphObject.ts:519

number

void

GraphObject.row


get rowSpan(): number

Defined in: panel/GraphObject.ts:533

GoJS-compatible: The number of rows this object spans.

number

set rowSpan(value): void

Defined in: panel/GraphObject.ts:537

number

void

GraphObject.rowSpan


get scale(): number

Defined in: panel/GraphObject.ts:564

GoJS-compatible: The scale of this object relative to its normal size.

number

set scale(value): void

Defined in: panel/GraphObject.ts:568

number

void

GraphObject.scale


get shadow(): string

Defined in: panel/GraphObject.ts:614

GoJS-compatible: Alias for shadowColor.

string

set shadow(value): void

Defined in: panel/GraphObject.ts:618

string

void

GraphObject.shadow


get shadowBlur(): number

Defined in: panel/GraphObject.ts:605

GoJS-compatible: The drop shadow blur radius.

number

set shadowBlur(value): void

Defined in: panel/GraphObject.ts:609

number

void

GraphObject.shadowBlur


get shadowColor(): string

Defined in: panel/GraphObject.ts:587

GoJS-compatible: The drop shadow color.

string

set shadowColor(value): void

Defined in: panel/GraphObject.ts:591

string

void

GraphObject.shadowColor


get shadowOffset(): object

Defined in: panel/GraphObject.ts:596

GoJS-compatible: The drop shadow offset.

object

x: number

y: number

set shadowOffset(value): void

Defined in: panel/GraphObject.ts:600

number

number

void

GraphObject.shadowOffset


get stroke(): string

Defined in: panel/TextBlock.ts:66

GoJS-compatible: Alias for the text color (GoJS uses stroke).

string

set stroke(value): void

Defined in: panel/TextBlock.ts:70

string

void


get strokeWidth(): number

Defined in: panel/TextBlock.ts:75

GoJS-compatible: The width of the text outline (0 = no outline).

number

set strokeWidth(value): void

Defined in: panel/TextBlock.ts:79

number

void


get text(): string

Defined in: panel/TextBlock.ts:49

string

set text(value): void

Defined in: panel/TextBlock.ts:53

string

void


get textAlign(): "left" | "right" | "center"

Defined in: panel/TextBlock.ts:206

"left" | "right" | "center"

set textAlign(value): void

Defined in: panel/TextBlock.ts:210

"left" | "right" | "center"

void


get visible(): boolean

Defined in: panel/GraphObject.ts:370

Whether this object is visible.

boolean

set visible(value): void

Defined in: panel/GraphObject.ts:374

boolean

void

GraphObject.visible


get width(): number

Defined in: panel/GraphObject.ts:453

GoJS-compatible: the last explicitly-set desired width, or NaN if never set — NOT the object’s current rendered size. Falling back to _actualSize here (as this used to) makes every measure() override (Shape/TextBlock/Picture/Panel, which all gate their real measurement behind !Number.isNaN(this.width)) permanently “lock onto” whatever size an earlier — possibly premature, e.g. before a data binding applied the real text — layout pass happened to produce, since that stale actualSize then reads back as “an explicit width was set” on every later pass and skips remeasuring for good. Those callers must check for NaN specifically, not > 0 — a Binding that legitimately resolves to 0 (e.g. a 0%-progress bar) is still an explicit width.

number

set width(value): void

Defined in: panel/GraphObject.ts:457

number

void

Placeholder.width


get wrap(): "None" | "Wrap" | "Ellipsis"

Defined in: panel/TextBlock.ts:102

GoJS-compatible: The wrapping mode.

"None" | "Wrap" | "Ellipsis"

set wrap(value): void

Defined in: panel/TextBlock.ts:106

"None" | "Wrap" | "Ellipsis"

void

addBinding(binding): this

Defined in: panel/GraphObject.ts:119

Add a binding to this graph object (keeps existing bindings).

Binding

this

GraphObject.addBinding


applyBindings(nodeData): number

Defined in: panel/GraphObject.ts:185

Apply all bindings from model data to this graph object.

NodeData

number

GraphObject.applyBindings


clone(): this

Defined in: panel/TextBlock.ts:241

Deep copy of this text block.

this

GraphObject.clone


containsPoint(px, py): boolean

Defined in: panel/GraphObject.ts:675

Check if a point is inside this object’s area (for hit testing).

number

number

boolean

GraphObject.containsPoint


draw(ctx, x, y, width, height): void

Defined in: panel/TextBlock.ts:293

Draw this object at its computed position and size.

CanvasRenderingContext2D

number

number

number

number

void

GraphObject.draw


getBounds(): Rect

Defined in: panel/GraphObject.ts:685

Get the bounds of this object within the panel coordinate space.

Rect

GraphObject.getBounds


measure(): Size

Defined in: panel/TextBlock.ts:255

Measure the natural size of this object. Returns the size this object would like to occupy.

Size

GraphObject.measure


measureWithMargin(): Size

Defined in: panel/GraphObject.ts:663

Compute the effective size after applying margin.

Size

GraphObject.measureWithMargin


removeBinding(targetProperty): boolean

Defined in: panel/GraphObject.ts:125

Remove a binding by target property. Returns true if removed.

string

boolean

GraphObject.removeBinding


setActualSize(width, height): void

Defined in: panel/GraphObject.ts:486

Set the actual size during layout.

number

number

void

GraphObject.setActualSize


setBinding(binding): this

Defined in: panel/GraphObject.ts:112

GoJS-compatible: Set a binding on this graph object, replacing any existing binding with the same target property.

Binding

this

GraphObject.setBinding


setColor(value): this

Defined in: panel/TextBlock.ts:229

Fluent setter for color.

string

this


setFont(value): this

Defined in: panel/TextBlock.ts:235

Fluent setter for font.

string

this


setPosition(x, y): void

Defined in: panel/GraphObject.ts:476

Set the position within the parent panel.

number

number

void

GraphObject.setPosition


setText(value): this

Defined in: panel/TextBlock.ts:223

Fluent setter for text.

string

this


theme(targetprop, sourceprop?, themeSource?, conv?, themeconv?): this

Defined in: panel/GraphObject.ts:137

GoJS-compatible: add a ThemeBinding from a literal Theme property name to targetprop, e.g. .theme("stroke", "text") assigns stroke to the current theme’s colors.text.

string

string

string | null

(value, data) => unknown

(value, target) => unknown

this

GraphObject.theme


themeData(targetprop, sourceprop?, themeSource?, conv?, themeconv?): this

Defined in: panel/GraphObject.ts:153

GoJS-compatible: add a ThemeBinding whose theme key comes from a data property’s value, e.g. .themeData("fill", "state") looks up data.state and uses that as the colors key.

string

string

string | null

(value, data) => unknown

(value, target) => unknown

this

GraphObject.themeData


themeModel(targetprop, sourceprop?, themeSource?, conv?, themeconv?): this

Defined in: panel/GraphObject.ts:171

GoJS-compatible: like themeData, but sourced from model-wide data. graphojs has no Model.modelData, so this currently behaves exactly like themeData (resolved against the part’s own data instead).

string

string

string | null

(value, data) => unknown

(value, target) => unknown

this

GraphObject.themeModel


static make(builder, …args): Panel

Defined in: panel/GraphObject.ts:203

GoJS-compatible static factory method.

Usage: const $ = go.GraphObject.make; const shape = $(go.Shape, “RoundedRectangle”, { fill: “white”, stroke: “gray” }); const panel = $(go.Panel, “Auto”, shape, $(go.TextBlock, “Hello”));

string

unknown[]

Panel

GraphObject.make

static make(ctor, …args): Panel

Defined in: panel/GraphObject.ts:204

GoJS-compatible static factory method.

Usage: const $ = go.GraphObject.make; const shape = $(go.Shape, “RoundedRectangle”, { fill: “white”, stroke: “gray” }); const panel = $(go.Panel, “Auto”, shape, $(go.TextBlock, “Hello”));

typeof Node | typeof Link | typeof Group

unknown[]

Panel

GraphObject.make

static make<T>(ctor, …args): T

Defined in: panel/GraphObject.ts:205

GoJS-compatible static factory method.

Usage: const $ = go.GraphObject.make; const shape = $(go.Shape, “RoundedRectangle”, { fill: “white”, stroke: “gray” }); const panel = $(go.Panel, “Auto”, shape, $(go.TextBlock, “Hello”));

T

(…args) => T

unknown[]

T

GraphObject.make