Ir al contenido

Part

Defined in: parts/Part.ts:25

Base class for all visual parts in a diagram (Node/Link/Group specialize it, but it’s directly instantiable too — GoJS-compatible: a bare new go.Part() is a decoration outside the model, e.g. a frame or watermark, added with Diagram.add() and never appearing in model.nodeDataArray. key auto-assigns a unique negative number when omitted, since a loose Part has no model row to key off of.

new Part(key?, bounds?): Part

Defined in: parts/Part.ts:67

NodeKey

Rect

Part

get actualBounds(): Rect

Defined in: parts/Part.ts:230

GoJS-compatible: The actual bounds of this part in document coordinates.

Rect

set actualBounds(value): void

Defined in: parts/Part.ts:234

Rect

void


get adornments(): ReadonlyMap<string, Adornment>

Defined in: parts/Part.ts:572

Get all adornments on this part.

ReadonlyMap<string, Adornment>


get angle(): number

Defined in: parts/Part.ts:313

The rotation angle in degrees.

number

set angle(value): void

Defined in: parts/Part.ts:317

number

void


get background(): string | null

Defined in: parts/Part.ts:185

GoJS-compatible: The background color of this part.

string | null

set background(value): void

Defined in: parts/Part.ts:189

string | null

void


get bindings(): readonly Binding[]

Defined in: parts/Part.ts:603

Get all bindings on this part.

readonly Binding[]


get bounds(): Rect

Defined in: parts/Part.ts:135

Rect

set bounds(value): void

Defined in: parts/Part.ts:139

Rect

void


get category(): string

Defined in: parts/Part.ts:368

GoJS-compatible: The category of this part (used to select a template).

string

set category(value): void

Defined in: parts/Part.ts:372

string

void


get center(): object

Defined in: parts/Part.ts:663

Get the center point.

object

x: number

y: number


get containingGroup(): Part | null

Defined in: parts/Part.ts:405

Get the containing group, or null if top-level.

Part | null

set containingGroup(value): void

Defined in: parts/Part.ts:410

Set the containing group.

Group | null

void


get contextMenu(): Panel | HTMLInfo | null

Defined in: parts/Part.ts:488

GoJS-compatible: a context menu shown on right-click — a Panel template drawn to canvas, or an HTMLInfo for full control over an HTML element.

Panel | HTMLInfo | null

set contextMenu(value): void

Defined in: parts/Part.ts:492

Panel | HTMLInfo | null

void


get copyable(): boolean

Defined in: parts/Part.ts:118

GoJS-compatible: Whether this part can be copied.

boolean

set copyable(value): void

Defined in: parts/Part.ts:122

boolean

void


get cursor(): string

Defined in: parts/Part.ts:203

GoJS-compatible: The cursor shown when hovering this part.

string

set cursor(value): void

Defined in: parts/Part.ts:207

string

void


get data(): NodeData | null

Defined in: parts/Part.ts:359

GoJS-compatible: Reference to the model data object for this part.

NodeData | null

set data(value): void

Defined in: parts/Part.ts:363

NodeData | null

void


get deletable(): boolean

Defined in: parts/Part.ts:96

GoJS-compatible: Whether this part can be deleted.

boolean

set deletable(value): void

Defined in: parts/Part.ts:100

boolean

void


get desiredSize(): Size | null

Defined in: parts/Part.ts:162

GoJS-compatible: The desired size of this part.

Size | null

set desiredSize(value): void

Defined in: parts/Part.ts:167

Size | { height: number; width: number; } | null

void


get diagram(): Diagram | null

Defined in: parts/Part.ts:443

GoJS-compatible: The diagram that this part is in (or null).

Diagram | null

set diagram(value): void

Defined in: parts/Part.ts:448

Set the diagram this part belongs to.

Diagram | null

void


get dragAlpha(): number

Defined in: parts/Part.ts:377

GoJS-compatible: The opacity used when this part is being dragged.

number

set dragAlpha(value): void

Defined in: parts/Part.ts:381

number

void


get draggable(): boolean

Defined in: parts/Part.ts:506

Whether this part can be dragged.

boolean

set draggable(value): void

Defined in: parts/Part.ts:510

boolean

void


get elements(): readonly GraphObject[]

Defined in: parts/Part.ts:546

GoJS-compatible: Get the child elements in this part’s visual tree.

readonly GraphObject[]


get fill(): string

Defined in: parts/Part.ts:280

string

set fill(value): void

Defined in: parts/Part.ts:284

string

void


get height(): number

Defined in: parts/Part.ts:153

GoJS-compatible: The height of this part (delegates to its bounds).

number

set height(value): void

Defined in: parts/Part.ts:157

number

void


get isHighlighted(): boolean

Defined in: parts/Part.ts:127

GoJS-compatible: Whether this part is currently highlighted.

boolean

set isHighlighted(value): void

Defined in: parts/Part.ts:131

boolean

void


get isInDocumentBounds(): boolean

Defined in: parts/Part.ts:386

GoJS-compatible: Whether this part is within the document bounds.

boolean

set isInDocumentBounds(value): void

Defined in: parts/Part.ts:390

boolean

void


get isMemberOfGroup(): boolean

Defined in: parts/Part.ts:415

GoJS-compatible: Whether this part is a member of a group.

boolean


get isPositioned(): boolean

Defined in: parts/Part.ts:420

GoJS-compatible: Whether this part has been given a position/bounds.

boolean


get isSelected(): boolean

Defined in: parts/Part.ts:264

boolean

set isSelected(value): void

Defined in: parts/Part.ts:268

boolean

void


get isTreeExpanded(): boolean

Defined in: parts/Part.ts:109

GoJS-compatible: Whether this part’s tree-children (per findTreeChildrenNodes) are shown. Distinct from Group.isSubGraphExpanded — this applies to any Part and is what TreeExpanderButton toggles via Diagram.collapseTree/expandTree.

boolean

set isTreeExpanded(value): void

Defined in: parts/Part.ts:113

boolean

void


get isVisibleObject(): boolean

Defined in: parts/Part.ts:239

GoJS-compatible: Whether this part and its ancestors are visible.

boolean


get key(): NodeKey

Defined in: parts/Part.ts:72

NodeKey


get layer(): Layer | null

Defined in: parts/Part.ts:425

Get the layer this part belongs to.

Layer | null

set layer(value): void

Defined in: parts/Part.ts:430

Set the layer this part belongs to.

Layer | null

void


get layerName(): string

Defined in: parts/Part.ts:395

GoJS-compatible: The name of the layer this part belongs to.

string

set layerName(_value): void

Defined in: parts/Part.ts:399

string

void


get location(): Point

Defined in: parts/Part.ts:326

GoJS-compatible: The location point of this part — the point within the bounds at locationSpot. With the default locationSpot (0.5, 0.5) this is the center; changing locationSpot moves the part so the spot stays put.

Point

set location(value): void

Defined in: parts/Part.ts:334

Point

void


get locationSpot(): object

Defined in: parts/Part.ts:341

GoJS-compatible: The spot in the part that corresponds to the location point.

object

x: number

y: number

set locationSpot(value): void

Defined in: parts/Part.ts:345

number

number

void


get maxSize(): object

Defined in: parts/Part.ts:221

GoJS-compatible: The maximum size of this part.

object

height: number

width: number

set maxSize(value): void

Defined in: parts/Part.ts:225

number

number

void


get minSize(): object

Defined in: parts/Part.ts:212

GoJS-compatible: The minimum size of this part.

object

height: number

width: number

set minSize(value): void

Defined in: parts/Part.ts:216

number

number

void


get name(): string

Defined in: parts/Part.ts:87

GoJS-compatible: an arbitrary name for this part. Real GoJS has this because Part extends GraphObject, which has its own .name (used for findObject-style lookups); graphojs’s Part is a separate class, so it needs its own copy of the same property rather than inheriting it — most relevant for a bare decorative Part (see Diagram.add), which ported GoJS code may still identify by .name the way it would identify any other GraphObject.

string

set name(value): void

Defined in: parts/Part.ts:91

string

void


get opacity(): number

Defined in: parts/Part.ts:272

number

set opacity(value): void

Defined in: parts/Part.ts:276

number

void


get panel(): Panel | null

Defined in: parts/Part.ts:533

GoJS-compatible: Get the panel used to render this part’s visual tree.

Panel | null

set panel(value): void

Defined in: parts/Part.ts:538

GoJS-compatible: Set the panel used to render this part’s visual tree.

Panel | null

void


get pickable(): boolean

Defined in: parts/Part.ts:194

GoJS-compatible: Whether this part is pickable (hit-testable).

boolean

set pickable(value): void

Defined in: parts/Part.ts:198

boolean

void


get position(): object

Defined in: parts/Part.ts:668

Get the position (top-left).

object

x: number

y: number

set position(value): void

Defined in: parts/Part.ts:673

Set the position (top-left), preserving size.

number

number

void


get resizable(): boolean

Defined in: parts/Part.ts:515

Whether this part can be resized.

boolean

set resizable(value): void

Defined in: parts/Part.ts:519

boolean

void


get rotatable(): boolean

Defined in: parts/Part.ts:524

Whether this part can be rotated.

boolean

set rotatable(value): void

Defined in: parts/Part.ts:528

boolean

void


get scale(): number

Defined in: parts/Part.ts:176

GoJS-compatible: The scale of this part.

number

set scale(value): void

Defined in: parts/Part.ts:180

number

void


get selectable(): boolean

Defined in: parts/Part.ts:256

boolean

set selectable(value): void

Defined in: parts/Part.ts:260

boolean

void


get selectionObject(): GraphObject | null

Defined in: parts/Part.ts:350

GoJS-compatible: The GraphObject that is used as the selection object (for adornment placement).

GraphObject | null

set selectionObject(_value): void

Defined in: parts/Part.ts:354

GraphObject | null

void


get size(): object

Defined in: parts/Part.ts:679

Get the size.

object

height: number

width: number


get stroke(): string

Defined in: parts/Part.ts:288

string

set stroke(value): void

Defined in: parts/Part.ts:292

string

void


get strokeWidth(): number

Defined in: parts/Part.ts:296

number

set strokeWidth(value): void

Defined in: parts/Part.ts:300

number

void


get tooltip(): string

Defined in: parts/Part.ts:463

The tooltip text shown when hovering over this part.

string

set tooltip(value): void

Defined in: parts/Part.ts:467

string

void


get toolTip(): Panel | HTMLInfo | null

Defined in: parts/Part.ts:475

GoJS-compatible: a tooltip shown on hover — a Panel template drawn to canvas, or an HTMLInfo for full control over an HTML element.

Panel | HTMLInfo | null

set toolTip(value): void

Defined in: parts/Part.ts:479

Panel | HTMLInfo | null

void


get tooltipVisible(): boolean

Defined in: parts/Part.ts:497

Whether the tooltip is currently visible.

boolean

set tooltipVisible(value): void

Defined in: parts/Part.ts:501

boolean

void


get visible(): boolean

Defined in: parts/Part.ts:248

boolean

set visible(value): void

Defined in: parts/Part.ts:252

boolean

void


get width(): number

Defined in: parts/Part.ts:144

GoJS-compatible: The width of this part (delegates to its bounds).

number

set width(value): void

Defined in: parts/Part.ts:148

number

void


get zOrder(): number

Defined in: parts/Part.ts:304

number

set zOrder(value): void

Defined in: parts/Part.ts:308

number

void

addAdornment(name, adornment): void

Defined in: parts/Part.ts:582

Add an adornment to this part.

string

Adornment

void


addBinding(binding): this

Defined in: parts/Part.ts:608

Add a binding to this part.

Binding

this


addVisual(element): this

Defined in: parts/Part.ts:551

GoJS-compatible: Add a child element to this part’s visual tree.

GraphObject

this


applyBindings(nodeData): number

Defined in: parts/Part.ts:632

Apply all bindings from model data to this part. Returns the number of properties set.

NodeData

number


applyTwoWayBindings(nodeData): number

Defined in: parts/Part.ts:647

Apply TwoWay bindings: write Part properties back to model data.

NodeData

number


clearAdornments(): void

Defined in: parts/Part.ts:598

Remove all adornments from this part.

void


clearBindings(): void

Defined in: parts/Part.ts:622

Remove all bindings from this part.

void


containsPoint(point): boolean

Defined in: parts/Part.ts:658

Check if a point is inside this part.

number

number

boolean


copy(): this

Defined in: parts/Part.ts:684

Create a deep copy of this part.

this


findAdornment(name): Adornment | undefined

Defined in: parts/Part.ts:577

Get a specific adornment by name.

string

Adornment | undefined


findAdornmentNamed(name): Adornment | null

Defined in: parts/Part.ts:588

GoJS-compatible: Find an adornment by name, or null if not present.

string

Adornment | null


findBinding(targetProperty): Binding | undefined

Defined in: parts/Part.ts:627

Find a binding targeting a specific property.

string

Binding | undefined


findDiagram(): Diagram | null

Defined in: parts/Part.ts:453

GoJS-compatible: Find the diagram that contains this part.

Diagram | null


findLayer(): Layer | null

Defined in: parts/Part.ts:458

GoJS-compatible: Find the layer that contains this part.

Layer | null


findObject(name): GraphObject | null

Defined in: parts/Part.ts:566

GoJS-compatible: Find a GraphObject by name in this part’s visual tree.

string

GraphObject | null


removeAdornment(name): boolean

Defined in: parts/Part.ts:593

Remove an adornment from this part.

string

boolean


removeBinding(binding): boolean

Defined in: parts/Part.ts:614

Remove a binding from this part.

Binding

boolean


removeVisual(element): boolean

Defined in: parts/Part.ts:560

GoJS-compatible: Remove a child element from this part’s visual tree.

GraphObject

boolean