Part$Typings extension

on

Properties

adornments Iterator<Adornment>
This read-only property returns an iterator over all of the Adornments associated with this part. After each call to the iterator's next() method that returns true, the iterator's key will be the category and the iterator's value will be an Adornment.
getter/setter pair
category String
Gets or sets the category of this part, typically used to distinguish different kinds of nodes or links.
getter/setter pair
containingGroup Group?
Gets or sets the Group of which this Part or Node is a member. This will be null if this is a top-level part.
getter/setter pair
containingGroupChanged ↔ (void Function(Part, [Group?, Group?])?)
Gets or sets the function that is called after this Part has changed which Group it belongs to, if any. It is typically used to modify the appearance of the part. The first argument will be this Part. The second argument will be the old Group, or null if it had been a top-level part. The third argument will be the new Group, or null if it is now a top-level part.
getter/setter pair
copyable bool
Gets or sets whether the user may copy this part. The initial value is true.
getter/setter pair
deletable bool
Gets or sets whether the user may delete this part. The initial value is true.
getter/setter pair
diagram Diagram?
This read-only property returns the Diagram that this Part is in.
getter/setter pair
dragComputation ↔ (Point Function(Part, Point, Point)?)
Gets or sets the function used to determine the location that this Part can be dragged to. The first argument is a reference to the Part being dragged, the second argument is a Point describing the proposed location, and the third argument is a snapped location, if one was determined during dragging. It should return a Point that is the proposed new location.
getter/setter pair
groupable bool
Gets or sets whether the user may group this part to be a member of a new Group. The initial value is true.
getter/setter pair
highlightedChanged ↔ (void Function(Part)?)
Gets or sets the function to execute when this #isHighlighted changes. It is typically used to modify the appearance of the part. This function must not highlight or unhighlight any parts.
getter/setter pair
isAnimated bool
Gets or sets whether this part may be animated. The initial value is true.
getter/setter pair
isHighlighted bool
Gets or sets whether this Part is highlighted. The initial value is false.
getter/setter pair
isInDocumentBounds bool
Gets or sets whether this Part is part of the document bounds.
getter/setter pair
isLayoutPositioned bool
Gets or sets whether a Layout positions this Node or routes this Link. This property affects the value of #canLayout.
getter/setter pair
isSelected bool
Gets or sets whether this Part is selected. The initial value is false.
getter/setter pair
isShadowed bool
Gets or sets whether this part will draw shadows. The initial value is false.
getter/setter pair
isTopLevel bool
This read-only property is true when this part is not member of any Group node nor is it a label node for a Link.
getter/setter pair
key ↔ dynamic
This read-only property returns the Part's Model data key if it is in a Diagram and is backed by Model data. Otherwise this returns undefined.
getter/setter pair
layer Layer?
This read-only property returns the Layer that this Part is in. The value is the Layer that is named with the value of #layerName. If you want to change what Layer this Part is in, change the value of #layerName to refer to a different Layer.
getter/setter pair
layerChanged ↔ (void Function(Part, [Layer?, Layer?])?)
Gets or sets the function to execute when this part changes layers. It is typically used to modify the appearance of the part. This function must not change the layer of this part by setting #layerName.
getter/setter pair
layerName String
Gets or sets the layer name for this part. The initial value is an empty string, which is the name of the default layer. The value of this property determines the value of #layer.
getter/setter pair
layoutConditions num
Gets or sets flags that control when the Layout that is responsible for this Part is invalidated. The initial value is Part.LayoutStandard, which causes the layout for this part to be invalidated when the part is added or removed or changes visibility or size.
getter/setter pair
location Point
Gets or sets the position of this part in document coordinates, based on the #locationSpot in this part's #locationObject.
getter/setter pair
locationObject GraphObject
This read-only property returns the GraphObject that determines the location of this Part. The value will be in the visual tree of this Part and is usually named with the value of #locationObjectName.
getter/setter pair
locationObjectName String
Gets or sets the name of the GraphObject that provides the location of this Part. This name determines the value of #locationObject. The actual #location also depends on the #locationSpot.
getter/setter pair
locationSpot Spot
Gets or sets the location Spot of this Node, the spot on the #locationObject that is used in positioning this part in the diagram.
getter/setter pair
maxLocation Point
Gets or sets the maximum location of this Part to which the user may drag using the DraggingTool.
getter/setter pair
minLocation Point
Gets or sets the minimum location of this Part to which the user may drag using the DraggingTool.
getter/setter pair
movable bool
Gets or sets whether the user may move this part. The initial value is true.
getter/setter pair
reshapable bool
Gets or sets whether the user may reshape this part. The initial value is false.
getter/setter pair
resizable bool
Gets or sets whether the user may resize this part. The initial value is false.
getter/setter pair
resizeAdornmentTemplate Adornment?
Gets or sets the adornment template used to create a resize handle Adornment for this part. This is used by the ResizingTool, ToolManager#resizingTool.
getter/setter pair
resizeCellSize Size
Gets or sets the width and height multiples used when resizing. By default this property is the Size(NaN, NaN).
getter/setter pair
resizeObject GraphObject
This read-only property returns the GraphObject that should get resize handles when this part is selected. The value will be in the visual tree of this Part and is usually named with the value of #resizeObjectName.
getter/setter pair
resizeObjectName String
Gets or sets the name of the GraphObject that should get a resize handle when this part is selected. The value of this property affects the value of #resizeObject. The initial value is an empty string, meaning the whole Part itself gets any resize handle.
getter/setter pair
rotatable bool
Gets or sets whether the user may rotate this part. The initial value is false.
getter/setter pair
rotateAdornmentTemplate Adornment?
Gets or sets the adornment template used to create a rotation handle Adornment for this part. This is used by the RotatingTool, ToolManager#rotatingTool.
getter/setter pair
rotateObject GraphObject
This read-only property returns the GraphObject that should get rotate handles when this part is selected. The value will be in the visual tree of this Part and is usually named with the value of #rotateObjectName.
getter/setter pair
rotateObjectName String
Gets or sets the name of the GraphObject that should get a rotate handle when this part is selected. The value of this property affects the value of #rotateObject. The initial value is an empty string, meaning the whole Part itself gets any rotate handle.
getter/setter pair
rotationSpot Spot
Gets or sets the spot on the #rotateObject that is used in rotating this part with the RotatingTool.
getter/setter pair
selectable bool
Gets or sets whether the user may select this part. The initial value is true.
getter/setter pair
selectionAdorned bool
Gets or sets whether a selection adornment is shown for this part when it is selected. The initial value is true.
getter/setter pair
selectionAdornmentTemplate Adornment?
Gets or sets the Adornment template used to create a selection handle for this Part.
getter/setter pair
selectionChanged ↔ (void Function(Part)?)
Gets or sets the function to execute when this part is selected or deselected. It is typically used to modify the appearance of the part. This function must not select or deselect any parts.
getter/setter pair
selectionObject GraphObject
This read-only property returns the GraphObject that should get a selection handle when this part is selected. The value will be in the visual tree of this Part and is usually named with the value of #selectionObjectName. When the #selectionObjectName is unspecified, this whole Part is used as the "selection object".
getter/setter pair
selectionObjectName String
Gets or sets the name of the GraphObject that should get a selection handle when this part is selected. The value of this property affects the value of #selectionObject. The initial value is an empty string, meaning the whole Part itself gets any selection handle.
getter/setter pair
shadowBlur num
Gets or sets the numerical value that describes the shadow's blur. Number must be non-negative and non-infinity. A value of 0 would mean the shadow does not blur and larger numbers represent increasingly more blur. The total blur area is independent of the Part's area and can become quite large as this number is increased.
getter/setter pair
shadowColor String
Gets or sets the CSS string that describes a shadow color. Default is 'gray'. Brushes cannot be used for this property -- only strings.
getter/setter pair
shadowOffset Point
Gets or sets the X and Y offset of this part's shadow. This is only relevant if #isShadowed is true. The initial value is (6, 6).
getter/setter pair
text String
Gets or sets a text string that is associated with this part.
getter/setter pair
textEditable bool
Gets or sets whether the user may do in-place text editing on TextBlocks in this part that have TextBlock#editable set to true. The initial value is true.
getter/setter pair
zOrder num
Gets or sets the Z-ordering position of this Part within its Layer.
getter/setter pair

Methods

addAdornment(String category, Adornment ad) → void
Associate an Adornment with this Part, perhaps replacing any existing adornment of the same category. Don't forget to set Adornment#adornedObject before calling this method. This adds the Adornment to the Layer named by #layerName, normally "Adornment".
canCopy() bool
This predicate returns true if #copyable is true, if the layer's Layer#allowCopy is true, and if the diagram's Diagram#allowCopy is true.
canDelete() bool
This predicate returns true if #deletable is true, if the layer's Layer#allowDelete is true, and if the diagram's Diagram#allowDelete is true.
canEdit() bool
This predicate returns true if #textEditable is true, if the layer's Layer#allowTextEdit is true, and if the diagram's Diagram#allowTextEdit is true.
canGroup() bool
This predicate returns true if #groupable is true, if the layer's Layer#allowGroup is true, and if the diagram's Diagram#allowGroup is true.
canLayout() bool
This predicate is called by Layout implementations to decide whether this Part should be positioned and might affect the positioning of other Parts.
canMove() bool
This predicate returns true if #movable is true, if the layer's Layer#allowMove is true, and if the diagram's Diagram#allowMove is true.
canReshape() bool
This predicate returns true if #reshapable is true, if the layer's Layer#allowReshape is true, and if the diagram's Diagram#allowReshape is true.
canResize() bool
This predicate returns true if #resizable is true, if the layer's Layer#allowResize is true, and if the diagram's Diagram#allowResize is true.
canRotate() bool
This predicate returns true if #rotatable is true, if the layer's Layer#allowRotate is true, and if the diagram's Diagram#allowRotate is true.
canSelect() bool
This predicate returns true if #selectable is true, if the layer's Layer#allowSelect is true, and if the diagram's Diagram#allowSelect is true.
clearAdornments() → void
Remove all adornments associated with this part.
ensureBounds() → void
Measures if needed to make sure the GraphObject#measuredBounds and GraphObject#naturalBounds are all real numbers, primarily to get the actual width and height. GraphObject#actualBounds will get a real width and height, but the x and y values may continue to be NaN if they were that way beforehand.
findAdornment(String category) Adornment?
Find an Adornment of a given category associated with this Part.
findCommonContainingGroup(Part other) Group?
Find the Group that perhaps indirectly contains both this part and another one. If this is a Group and it contains the OTHER Part, return this. If the OTHER Part is a Group and it contains this Part, return that OTHER Part.
findSubGraphLevel() num
Return how deep this part is in the hierarchy of nested Groups. For parts that have no #containingGroup this returns zero.
findTopLevelPart() Part
Gets the top-level Part for this part, which is itself when #isTopLevel is true. If this Part is a member of a Group, this returns the top-level Part for that Group. If this is a Node that is a label node for a labeled Link, this returns the top-level Part for that Link.
getDocumentBounds([Rect? result]) Rect
Returns the Rect in document coordinates for this object's bounds. If this GraphObject is a Part, the rect will be identical to its #actualBounds. @param {Rect=} result an optional Rect that is modified and returned. @return {Rect} in document coordinates. @see #getDocumentPoint @since 2.0
invalidateAdornments() → void
(undocumented)
invalidateLayout([num? condition]) → void
Invalidate the Layout that is responsible for positioning this Part. If this part is in a Group, invalidate its Group#layout, if it has one. Otherwise invalidate the Diagram#layout.
isMemberOf(Part part) bool
This predicate is true if this part is a member of the given Part, perhaps indirectly.
isVisible() bool
This predicate is true if this Part can be seen. Parts that can be seen can be manipulated by the user, can take space in the document, or can take part in a layout, among many possibilities. Note that the value of this predicate can often be false even while GraphObject#visible is true.
move(Point newpos, [bool? useLocation]) → void
Move this part and any parts that are owned by this part to a new position.
moveTo(num newx, num newy, [bool? useLocation]) → void
Move this part and any parts that are owned by this part to a new position. This just calls #move without the caller having to allocate a new Point. @param {number} newx a new X value in document coordinates. @param {number} newy a new Y value in document coordinates. @param {boolean=} useLocation true if you want to set the #location instead of the position. False by default. @since 1.4
removeAdornment(String category) → void
Remove any Adornment of the given category that may be associated with this Part. @param {string} category a string identifying the kind or role of the given adornment for this Part.
updateAdornments() → void
This is responsible for creating any selection Adornment (if this Part #isSelected) and any tool adornments for this part. @expose
updateRelationshipsFromData() → void
Update all of the references to nodes in case they had been modified in the model without properly notifying the model by calling GraphLinksModel#setGroupKeyForNodeData or GraphLinksModel#setToKeyForLinkData or other similar methods. This method does not conduct a transaction, so you need to start and commit one yourself.
updateTargetBindings([String? srcprop]) → void
Re-evaluate all data bindings in this Part, in order to assign new property values to the GraphObjects in this visual tree based on this this object's #data property values. This method does nothing if #data is null.