Ir al contenido

GraphObject

Defined in: panel/GraphObject.ts:26

Base class for all visual elements that can appear in a Panel. GraphObjects are laid out by their containing Panel.

new GraphObject(): GraphObject

GraphObject

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

Defined in: panel/GraphObject.ts:86

InputEvent

GraphObject

void


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

Defined in: panel/GraphObject.ts:83

InputEvent

GraphObject

void


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

Defined in: panel/GraphObject.ts:84

InputEvent

GraphObject

void


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

Defined in: panel/GraphObject.ts:85

InputEvent

GraphObject

void


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

Defined in: panel/GraphObject.ts:68

InputEvent

GraphObject

void


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

Defined in: panel/GraphObject.ts:70

InputEvent

GraphObject

void


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

Defined in: panel/GraphObject.ts:69

InputEvent

GraphObject

void


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.


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

Defined in: panel/GraphObject.ts:71

InputEvent

GraphObject

GraphObject | null

void


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

Defined in: panel/GraphObject.ts:72

InputEvent

GraphObject

GraphObject | null

void


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

Defined in: panel/GraphObject.ts:74

InputEvent

GraphObject

void


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

Defined in: panel/GraphObject.ts:73

InputEvent

GraphObject

void


parentPanel: GraphObject | null = null

Defined in: panel/GraphObject.ts:89

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


portId: string = ''

Defined in: panel/GraphObject.ts:92

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

get actualSize(): Size

Defined in: panel/GraphObject.ts:481

The actual size computed during layout.

Size


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


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


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


get bindings(): readonly Binding[]

Defined in: panel/GraphObject.ts:104

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

readonly Binding[]


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


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


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


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


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


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


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


get isVisibleObject(): boolean

Defined in: panel/GraphObject.ts:379

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

boolean


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


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


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


get parent(): GraphObject | null

Defined in: panel/GraphObject.ts:389

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

GraphObject | null


get part(): Part | null

Defined in: panel/GraphObject.ts:394

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

Part | null


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


get position(): object

Defined in: panel/GraphObject.ts:471

The position within the parent panel.

object

x: number

y: number


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


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


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


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


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


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


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


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


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

addBinding(binding): this

Defined in: panel/GraphObject.ts:119

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

Binding

this


applyBindings(nodeData): number

Defined in: panel/GraphObject.ts:185

Apply all bindings from model data to this graph object.

NodeData

number


clone(): this

Defined in: panel/GraphObject.ts:737

Create a deep copy of this GraphObject. Subclasses override to copy their specific properties.

this


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


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

Defined in: panel/GraphObject.ts:652

Draw this object at its computed position and size.

CanvasRenderingContext2D

number

number

number

number

void


getBounds(): Rect

Defined in: panel/GraphObject.ts:685

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

Rect


abstract measure(): Size

Defined in: panel/GraphObject.ts:647

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

Size


measureWithMargin(): Size

Defined in: panel/GraphObject.ts:663

Compute the effective size after applying margin.

Size


removeBinding(targetProperty): boolean

Defined in: panel/GraphObject.ts:125

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

string

boolean


setActualSize(width, height): void

Defined in: panel/GraphObject.ts:486

Set the actual size during layout.

number

number

void


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


setPosition(x, y): void

Defined in: panel/GraphObject.ts:476

Set the position within the parent panel.

number

number

void


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


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


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


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

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

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