Options
Public/Protected
  • Public
  • Public/Protected
  • All
Menu

GoJS API 文档

Hierarchy

An Adornment is a special kind of Part that is associated with another Part, the Adornment.adornedPart.

Adornments are normally associated with a particular GraphObject in the adorned Part -- that is the value of adornedObject. However, the adornedObject may be null, in which case the adornedPart will also be null.

The area occupied by the adorned object is represented in the Adornment's visual tree by a Placeholder. The placeholder is always the Part.locationObject, although you may specify any Spot as the Part.locationSpot. An adornment need not have a placeholder, but it may have at most one.

Adornments can be distinguished by their Part.category. This property can be an arbitrary string value determined by the code creating the adornment, typically a tool that wants to be able to tell various adornments apart from each other. Use the Part.findAdornment method to find an adornment for a part of a given category.

For example, one of the Adornments created by Part.updateAdornments when the part Part.isSelected has the Part.category of "Selection". Those created by ResizingTool.updateAdornments have a category of "Resize" and normally contain eight resize handles.

Besides the selection Adornment and tool Adornments, Adornments are also used for context menus and tooltips. The adornedObject in such cases refers to the GraphObject to which the the context menu or tooltip applies.

There cannot be any links connected to an Adornment, nor can an Adornment have members or be a member of a group.

An Adornment cannot have its own Adornments. An Adornment cannot be selected.

Adornments are not positioned by a Layout because they are normally positioned according to the Part that they adorn.

For more discussion and examples, see Selection, ToolTips, Context Menus, and Tools.

Index

Constructors

constructor

Properties

adornedObject : GraphObject | null

  • Gets or sets the GraphObject that is adorned. Setting this property updates the adorned object's Part by calling Part.addAdornment. This may be null if the Adornment does not adorn a particular object.

Read-only adornedPart : Part | null

  • This read-only property returns the Part that contains the adorned object. This will be null if the adornedObject is null.

Read-only placeholder : Placeholder | null

  • This read-only property returns a Placeholder that this Adornment may contain in its visual tree. This may be null if there is no such placeholder object.

加入 GoJS 交流群
GoJS 交流群 (769862113)