37 KiB
title |
---|
DiamondNode |
Overview - v5.0.0-beta.21 / Modules / item / DiamondNode
item.DiamondNode
Hierarchy
-
↳
DiamondNode
Constructors
constructor
• new DiamondNode(props
)
Parameters
Name | Type |
---|---|
props |
any |
Overrides
Defined in
packages/g6/src/stdlib/item/node/diamond.ts:21
Methods
afterDraw
▸ afterDraw(model
, shapeMap
, shapesChanged?
): Object
Perform additional drawing operations or add custom shapes after drawing node.
Parameters
Name | Type | Description |
---|---|---|
model |
NodeDisplayModel | ComboDisplayModel |
The displayed model of this node, only for drawing and not received by users. |
shapeMap |
Object |
The shape map that contains all of the elements to show on the node. |
shapesChanged? |
string [] |
An array of shape IDs that have changed and need to be updated. |
Returns
Object
An object that contains some new shapes to be added to the node.
Inherited from
Defined in
packages/g6/src/stdlib/item/node/base.ts:230
calculateAnchorPosition
▸ calculateAnchorPosition(keyShapeStyle
): IAnchorPositionMap
Configures the anchor positions based on the provided keyShapeStyle and returns the configuration.
e.g for a CircleNode, it returns: {"right":keyShapeStyle.x+keyShapeStyle.r, keyShapeStyle.y}
Parameters
Name | Type | Description |
---|---|---|
keyShapeStyle |
any |
The keyShapeStyle object that contains the style information of the key shape. |
Returns
The anchor position configuration as an IAnchorPositionMap object.
Overrides
CustomNode.calculateAnchorPosition
Defined in
packages/g6/src/stdlib/item/node/diamond.ts:132
draw
▸ draw(model
, shapeMap
, diffData?
, diffState?
): NodeShapeMap
Draw all elements related to the node.
You should call drawKeyShape
and drawAnchorShape
,drawLabelShape
,drawIconShape
...as you like.
Parameters
Name | Type | Description |
---|---|---|
model |
NodeDisplayModel |
The displayed model of this node, only for drawing and not received by users. |
shapeMap |
NodeShapeMap |
The shape map that contains all of the elements to show on the node. |
diffData? |
Object |
An object that contains previous and current data. |
diffData.current |
NodeUserModelData |
- |
diffData.previous |
NodeUserModelData |
- |
diffState? |
Object |
An object that contains previous and current node's state. |
diffState.current |
State [] |
- |
diffState.previous |
State [] |
- |
Returns
NodeShapeMap
An object containing the keyShape and optional labelShape, iconShape, and some otherShapes properties
Overrides
Defined in
packages/g6/src/stdlib/item/node/diamond.ts:26
drawAnchorShapes
▸ drawAnchorShapes(model
, shapeMap
, diffData?
, diffState?
): Object
Draw the anchors shape of the node
Parameters
Name | Type | Description |
---|---|---|
model |
NodeDisplayModel | ComboDisplayModel |
The displayed model of this node, only for drawing and not received by users. |
shapeMap |
NodeShapeMap |
The shape map that contains all of the elements to show on the node. |
diffData? |
Object |
An object that contains previous and current data. |
diffData.current |
NodeUserModelData | ComboModelData |
- |
diffData.previous |
NodeUserModelData | ComboModelData |
- |
diffState? |
Object |
An object that contains previous and current node's state. |
diffState.current |
State [] |
- |
diffState.previous |
State [] |
- |
Returns
Object
The display object representing the anchors shape of the node.
Inherited from
Defined in
packages/g6/src/stdlib/item/node/base.ts:534
drawBadgeShapes
▸ drawBadgeShapes(model
, shapeMap
, diffData?
, diffState?
): Object
Draw the badges shape of the node
Parameters
Name | Type | Description |
---|---|---|
model |
NodeDisplayModel | ComboDisplayModel |
The displayed model of this node, only for drawing and not received by users. |
shapeMap |
NodeShapeMap |
The shape map that contains all of the elements to show on the node. |
diffData? |
Object |
An object that contains previous and current data. |
diffData.current |
NodeUserModelData | ComboModelData |
- |
diffData.previous |
NodeUserModelData | ComboModelData |
- |
diffState? |
Object |
An object that contains previous and current node's state. |
diffState.current |
State [] |
- |
diffState.previous |
State [] |
- |
Returns
Object
The display object representing the badges shape of the node.
Inherited from
Defined in
packages/g6/src/stdlib/item/node/base.ts:632
drawHaloShape
▸ drawHaloShape(model
, shapeMap
, diffData?
, diffState?
): DisplayObject
<any
, any
>
Draw the halo shape of the node
Parameters
Name | Type | Description |
---|---|---|
model |
NodeDisplayModel | ComboDisplayModel |
The displayed model of this node, only for drawing and not received by users. |
shapeMap |
NodeShapeMap |
The shape map that contains all of the elements to show on the node. |
diffData? |
Object |
An object that contains previous and current data. |
diffData.current |
NodeUserModelData | ComboModelData |
- |
diffData.previous |
NodeUserModelData | ComboModelData |
- |
diffState? |
Object |
An object that contains previous and current node's state. |
diffState.current |
State [] |
- |
diffState.previous |
State [] |
- |
Returns
DisplayObject
<any
, any
>
The display object representing the halo shape of the node.
Inherited from
Defined in
packages/g6/src/stdlib/item/node/base.ts:494
drawIconShape
▸ drawIconShape(model
, shapeMap
, diffData?
, diffState?
): DisplayObject
<any
, any
>
Draw the icon shape of the node
Parameters
Name | Type | Description |
---|---|---|
model |
NodeDisplayModel | ComboDisplayModel |
The displayed model of this node, only for drawing and not received by users. |
shapeMap |
NodeShapeMap |
The shape map that contains all of the elements to show on the node. |
diffData? |
Object |
An object that contains previous and current data. |
diffData.current |
NodeUserModelData | ComboModelData |
- |
diffData.previous |
NodeUserModelData | ComboModelData |
- |
diffState? |
Object |
An object that contains previous and current node's state. |
diffState.current |
State [] |
- |
diffState.previous |
State [] |
- |
Returns
DisplayObject
<any
, any
>
The display object representing the icon shape of the node.
Inherited from
Defined in
packages/g6/src/stdlib/item/node/base.ts:443
drawKeyShape
▸ drawKeyShape(model
, shapeMap
, diffData?
, diffState?
): DisplayObject
<any
, any
>
The key function of drawing shape. Draw the key shape of the node based on the provided model and shape map.
Parameters
Name | Type | Description |
---|---|---|
model |
NodeDisplayModel |
The displayed model of this node, only for drawing and not received by users. |
shapeMap |
NodeShapeMap |
The shape map that contains all of the elements to show on the node. |
diffData? |
Object |
An object that contains previous and current data. |
diffData.current |
NodeUserModelData |
- |
diffData.previous |
NodeUserModelData |
- |
diffState? |
Object |
An object that contains previous and current node's state. |
diffState.current |
State [] |
- |
diffState.previous |
State [] |
- |
Returns
DisplayObject
<any
, any
>
The display object representing the key shape of the node.
Overrides
Defined in
packages/g6/src/stdlib/item/node/diamond.ts:100
drawLabelBackgroundShape
▸ drawLabelBackgroundShape(model
, shapeMap
, diffData?
, diffState?
): DisplayObject
<any
, any
>
Draw the label background shape of the node
Parameters
Name | Type | Description |
---|---|---|
model |
NodeDisplayModel | ComboDisplayModel |
The displayed model of this node, only for drawing and not received by users. |
shapeMap |
NodeShapeMap |
The shape map that contains all of the elements to show on the node. |
diffData? |
Object |
An object that contains previous and current data. |
diffData.current |
NodeUserModelData | ComboModelData |
- |
diffData.previous |
NodeUserModelData | ComboModelData |
- |
diffState? |
Object |
An object that contains previous and current node's state. |
diffState.newState |
State [] |
- |
diffState.oldState |
State [] |
- |
Returns
DisplayObject
<any
, any
>
The display object representing the label background shape of the node.
Inherited from
CustomNode.drawLabelBackgroundShape
Defined in
packages/g6/src/stdlib/item/node/base.ts:386
drawLabelShape
▸ drawLabelShape(model
, shapeMap
, diffData?
, diffState?
): DisplayObject
<any
, any
>
Draw the label shape of the node
Parameters
Name | Type | Description |
---|---|---|
model |
NodeDisplayModel | ComboDisplayModel |
The displayed model of this node, only for drawing and not received by users. |
shapeMap |
NodeShapeMap |
The shape map that contains all of the elements to show on the node. |
diffData? |
Object |
An object that contains previous and current data. |
diffData.current |
NodeUserModelData | ComboModelData |
- |
diffData.previous |
NodeUserModelData | ComboModelData |
- |
diffState? |
Object |
An object that contains previous and current node's state. |
diffState.current |
State [] |
- |
diffState.previous |
State [] |
- |
Returns
DisplayObject
<any
, any
>
The display object representing the label shape of the node.
Inherited from
Defined in
packages/g6/src/stdlib/item/node/base.ts:278
drawOtherShapes
▸ drawOtherShapes(model
, shapeMap
, diffData?
, diffState?
): Object
Draw other shapes(such as preRect,stateIcon) of the node
Parameters
Name | Type | Description |
---|---|---|
model |
NodeDisplayModel | ComboDisplayModel |
The displayed model of this node, only for drawing and not received by users. |
shapeMap |
NodeShapeMap |
The shape map that contains all of the elements to show on the node. |
diffData? |
Object |
An object that contains previous and current data. |
diffData.current |
NodeUserModelData | ComboModelData |
- |
diffData.previous |
NodeUserModelData | ComboModelData |
- |
diffState? |
Object |
An object that contains previous and current node's state. |
diffState.current |
State [] |
- |
diffState.previous |
State [] |
- |
Returns
Object
The display object representing the other shapes of the node.
Inherited from
Defined in
packages/g6/src/stdlib/item/node/base.ts:795
getMergedStyles
▸ getMergedStyles(model
): NodeShapeStyles
Merge style
Parameters
Name | Type | Description |
---|---|---|
model |
NodeDisplayModel | ComboDisplayModel |
The NodeDisplayModel or ComboDisplayModel to retrieve the merged styles from. |
Returns
The merged styles as a NodeShapeStyles object.
Inherited from
Defined in
packages/g6/src/stdlib/item/node/base.ts:113
mergeStyles
▸ mergeStyles(model
): void
Get merged styles from getMergedStyles
and assigns the merged styles to the 'mergedStyles' property.
Parameters
Name | Type | Description |
---|---|---|
model |
NodeDisplayModel | ComboDisplayModel |
The NodeDisplayModel or ComboDisplayModel to merge the styles from. |
Returns
void
Inherited from
Defined in
packages/g6/src/stdlib/item/node/base.ts:104
onZoom
▸ onZoom(shapeMap
, zoom
): void
The listener for graph zooming.
- show / hide some shapes while zoom level changed;
- change the shapes' sizes to make them have same visual size while zooming, e.g. labelShape, labelBackgroundShape.
Parameters
Name | Type | Description |
---|---|---|
shapeMap |
NodeShapeMap |
The shape map that contains all of the elements to show on the node. |
zoom |
number |
The zoom level of the graph. |
Returns
void
Inherited from
Defined in
packages/g6/src/stdlib/item/node/base.ts:814
updateCache
▸ updateCache(shapeMap
): void
Call it after calling draw function to update cache about bounds and zoom levels.
Parameters
Name | Type | Description |
---|---|---|
shapeMap |
any |
The shape map that contains all of the elements to show on the node. |
Returns
void
Inherited from
Defined in
packages/g6/src/stdlib/item/node/base.ts:164
upsertShape
▸ upsertShape(type
, id
, style
, shapeMap
, model
): DisplayObject
<any
, any
>
Create (if does not exit in shapeMap) or update the shape according to the configurations.
Parameters
Name | Type | Description |
---|---|---|
type |
SHAPE_TYPE | SHAPE_TYPE_3D |
shape's type |
id |
string |
unique string to indicates the shape |
style |
Partial <CircleStyleProps & RectStyleProps & EllipseStyleProps & PolygonStyleProps & LineStyleProps & PolylineStyleProps & TextStyleProps & ImageStyleProps & PathStyleProps & SphereGeometryProps & CubeGeometryProps & PlaneGeometryProps & { interactive? : boolean } & { animates? : IAnimates ; lod? : number ; visible? : boolean }> |
style to be updated |
shapeMap |
NodeShapeMap |
the shape map of a node / combo |
model |
NodeDisplayModel | ComboDisplayModel |
data model of the node / combo |
Returns
DisplayObject
<any
, any
>
The display object representing the shape.
Inherited from
Defined in
packages/g6/src/stdlib/item/node/base.ts:987
Properties
boundsCache
• boundsCache: Object
Type declaration
Name | Type |
---|---|
keyShapeLocal? |
AABB |
labelShapeGeometry? |
AABB |
Inherited from
Defined in
packages/g6/src/stdlib/item/node/base.ts:44
defaultStyles
• defaultStyles: Object
Type declaration
Name | Type |
---|---|
keyShape |
{ size : number [] ; x : number = 0; y : number = 0 } |
keyShape.size |
number [] |
keyShape.x |
number |
keyShape.y |
number |
Overrides
Defined in
packages/g6/src/stdlib/item/node/diamond.ts:13
lodLevels
• Optional
lodLevels: LodStrategyObj
Inherited from
Defined in
packages/g6/src/stdlib/item/node/base.ts:43
mergedStyles
• mergedStyles: NodeShapeStyles
Overrides
Defined in
packages/g6/src/stdlib/item/node/diamond.ts:20
setState
• setState: (name
: string
, value
: boolean
, shapeMap
: { [shapeId: string]
: DisplayObject
; }) => void
Type declaration
▸ (name
, value
, shapeMap
): void
Set the state for the node.
Parameters
Name | Type | Description |
---|---|---|
name |
string |
- |
value |
boolean |
state value |
shapeMap |
Object |
The shape map that contains all of the elements to show on the node. |
Returns
void
Inherited from
Defined in
packages/g6/src/stdlib/item/node/base.ts:245
themeStyles
• themeStyles: NodeShapeStyles
| ComboShapeStyles
Inherited from
Defined in
packages/g6/src/stdlib/item/node/base.ts:41
type
• type: string