Ir al contenido

Panel

Defined in: panel/Panel.ts:25

A Panel is a GraphObject that contains and lays out other GraphObjects.

new Panel(type?): Panel

Defined in: panel/Panel.ts:72

PanelType = 'Auto'

Panel

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


columnDefinitions: object[] = []

Defined in: panel/Panel.ts:56

GoJS-compatible: Explicit column widths for Table panels.

optional separatorStrokeWidth?: number

optional width?: number


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

Defined in: panel/GraphObject.ts:70

InputEvent

GraphObject

void

GraphObject.contextClick


data: NodeData | null = null

Defined in: panel/Panel.ts:70

The data object most recently applied to this panel (for ofObject(“parent”)).


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

Defined in: panel/GraphObject.ts:69

InputEvent

GraphObject

void

GraphObject.doubleClick


gridCellSize: Size | null = null

Defined in: panel/Panel.ts:46

GoJS-compatible: the tile size for a 'Grid'-type panel — how often its children repeat, whether used standalone (nested in a template, needs an explicit width/height to know how large an area to tile) or as diagram.grid (read by Diagram.getGridPatternStyle instead of tiled directly). Defaults to 10x10 when unset.


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


rowDefinitions: object[] = []

Defined in: panel/Panel.ts:54

GoJS-compatible: Explicit row heights for Table panels (in the panel’s coordinate space).

optional height?: number

optional separatorStrokeWidth?: number


templateProperties: Record<string, unknown> = {}

Defined in: panel/Panel.ts:67

Extra properties to apply to the created part when this panel is used as a node/link/group template (e.g. link routing, corner, arrowhead).


readonly static Auto: "Auto" = 'Auto'

Defined in: panel/Panel.ts:27


readonly static Grid: "Grid" = 'Grid'

Defined in: panel/Panel.ts:34


readonly static Horizontal: "Horizontal" = 'Horizontal'

Defined in: panel/Panel.ts:29


readonly static Position: "Position" = 'Position'

Defined in: panel/Panel.ts:33


readonly static Spot: "Spot" = 'Spot'

Defined in: panel/Panel.ts:30


readonly static Table: "Table" = 'Table'

Defined in: panel/Panel.ts:31


readonly static Vertical: "Vertical" = 'Vertical'

Defined in: panel/Panel.ts:28


readonly static Viewbox: "Viewbox" = 'Viewbox'

Defined in: panel/Panel.ts:32

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 background(): string | null

Defined in: panel/Panel.ts:171

The background color of this panel.

string | null

set background(value): void

Defined in: panel/Panel.ts:175

string | null

void


get bindings(): readonly Binding[]

Defined in: panel/GraphObject.ts:104

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

readonly Binding[]

GraphObject.bindings


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

TextBlock.column


get columnCount(): number

Defined in: panel/Panel.ts:194

The number of columns (for Table panels).

number


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

TextBlock.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 defaultAlignment(): { x: number; y: number; } | null

Defined in: panel/Panel.ts:234

GoJS-compatible: The default alignment for elements in Spot panels.

{ x: number; y: number; } | null

set defaultAlignment(value): void

Defined in: panel/Panel.ts:238

{ x: number; y: number; } | null

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

TextBlock.desiredSize


get elementCount(): number

Defined in: panel/Panel.ts:148

The number of elements in this panel.

number


get elements(): readonly GraphObject[]

Defined in: panel/Panel.ts:143

The elements contained in this panel.

readonly GraphObject[]


get gradient(): CanvasGradient | null

Defined in: panel/Panel.ts:180

A canvas gradient used as the background.

CanvasGradient | null

set gradient(value): void

Defined in: panel/Panel.ts:184

CanvasGradient | 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

Placeholder.height


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 isVisibleObject(): boolean

Defined in: panel/GraphObject.ts:379

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

boolean

GraphObject.isVisibleObject


get itemArray(): readonly unknown[]

Defined in: panel/Panel.ts:78

GoJS-compatible: The data array used to generate item elements.

readonly unknown[]

set itemArray(value): void

Defined in: panel/Panel.ts:82

unknown[]

void


get itemTemplate(): GraphObject | null

Defined in: panel/Panel.ts:88

GoJS-compatible: The template used to create one element per item.

GraphObject | null

set itemTemplate(value): void

Defined in: panel/Panel.ts:92

GraphObject | null

void


get mainElement(): GraphObject | null

Defined in: panel/Panel.ts:315

Get the first element of this panel (used by Auto panels as background).

GraphObject | null


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 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 padding(): Margin | null

Defined in: panel/Panel.ts:153

The padding of this panel.

Margin | null

set padding(value): void

Defined in: panel/Panel.ts:157

Margin | null

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

TextBlock.row


get rowCount(): number

Defined in: panel/Panel.ts:189

The number of rows (for Table panels).

number


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

TextBlock.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 separators(): readonly GraphObject[]

Defined in: panel/Panel.ts:227

GoJS-compatible: The separators added to this panel.

readonly GraphObject[]


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 spacing(): number

Defined in: panel/Panel.ts:162

The spacing between elements (for Vertical/Horizontal panels).

number

set spacing(value): void

Defined in: panel/Panel.ts:166

number

void


get type(): PanelType

Defined in: panel/Panel.ts:134

PanelType

set type(value): void

Defined in: panel/Panel.ts:138

PanelType

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

TextBlock.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

add(element): this

Defined in: panel/Panel.ts:199

Add an element to this panel.

GraphObject

this


addBinding(binding): this

Defined in: panel/GraphObject.ts:119

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

Binding

this

GraphObject.addBinding


addSeparator(separator?): GraphObject

Defined in: panel/Panel.ts:209

GoJS-compatible: Add a visual separator element to this panel.

GraphObject

GraphObject


append(element): this

Defined in: panel/Panel.ts:272

Fluent add of an element.

GraphObject

this


applyBindings(nodeData): number

Defined in: panel/Panel.ts:933

Apply bindings to this panel and recursively to all child elements.

NodeData

number

GraphObject.applyBindings


clear(): void

Defined in: panel/Panel.ts:260

Remove all elements.

void


clone(): this

Defined in: panel/Panel.ts:896

Deep copy of this panel, including all child elements.

this

GraphObject.clone


contains(element): boolean

Defined in: panel/Panel.ts:267

Check if an element is in this panel.

GraphObject

boolean


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/Panel.ts:442

Draw this object at its computed position and size.

CanvasRenderingContext2D

number

number

number

number

void

GraphObject.draw


findElement(name): GraphObject | null

Defined in: panel/Panel.ts:869

GoJS-compatible: Find a GraphObject by name, searching this panel and nested panels.

string

GraphObject | null


findObject(name): GraphObject | null

Defined in: panel/Panel.ts:881

GoJS-compatible alias: real GoJS names this method findObject.

string

GraphObject | null


getBounds(): Rect

Defined in: panel/Panel.ts:886

The bounds of this panel within the parent coordinate space.

Rect

GraphObject.getBounds


hitTest(px, py): GraphObject | null

Defined in: panel/Panel.ts:851

Find the top-most GraphObject at a point, or null.

number

number

GraphObject | null


insertAt(index, element): this

Defined in: panel/Panel.ts:243

GoJS-compatible: Insert an element at a specific index.

number

GraphObject

this


measure(): Size

Defined in: panel/Panel.ts:319

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


remove(element): boolean

Defined in: panel/Panel.ts:251

Remove an element from this panel.

GraphObject

boolean


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


setBackground(value): this

Defined in: panel/Panel.ts:289

Fluent setter for background.

string | null

this


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


setPadding(value): this

Defined in: panel/Panel.ts:277

Fluent setter for padding.

Margin | null

this


setPosition(x, y): void

Defined in: panel/GraphObject.ts:476

Set the position within the parent panel.

number

number

void

GraphObject.setPosition


setSpacing(value): this

Defined in: panel/Panel.ts:283

Fluent setter for spacing.

number

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