Collapse element
collapseElement(id: ID, options?: boolean | CollapseExpandNodeOptions): Promise<void>;
Parameter | Type | Description |
---|---|---|
id | string | 元素 ID |
options | boolean | | 是否启用动画或者配置收起节点的配置项 |
Returns:
Expand Element
expandElement(id: ID, options?: boolean | CollapseExpandNodeOptions): Promise<void>;
Parameter | Type | Description |
---|---|---|
id | string | 元素 ID |
options | boolean | |
Returns:
Bring the element to the front
frontElement(id: ID | ID[]): Promise<void>;
Parameter | Type | Description |
---|---|---|
id | string | string[] | 元素 ID |
Returns:
Get element position
getElementPosition(id: ID): Point;
Parameter | Type | Description |
---|---|---|
id | string | 元素 ID |
Returns:
Type: [number, number] | [number, number, number] | Float32Array
Description: 元素位置
Get the rendering bounding box of the element itself and its child nodes in the world coordinate system
getElementRenderBounds(id: ID): AABB;
Parameter | Type | Description |
---|---|---|
id | string | 元素 ID |
Returns:
Type: AABB
Description: 渲染包围盒
Get element rendering style
getElementRenderStyle(id: ID): Record<string, any>;
Parameter | Type | Description |
---|---|---|
id | string | 元素 ID |
Returns:
Type: Record<string, any>
Description: 元素渲染样式
Get element state
getElementState(id: ID): State[];
Parameter | Type | Description |
---|---|---|
id | string | 元素 ID |
Returns:
Type: string[]
Description: 元素状态
Get element type
getElementType(id: ID): ElementType;
Parameter | Type | Description |
---|---|---|
id | string | 元素 ID |
Returns:
Type: 'node' | 'edge' | 'combo'
Description: 元素类型
Get element visibility
getElementVisibility(id: ID): BaseStyleProps['visibility'];
Parameter | Type | Description |
---|---|---|
id | string | 元素 ID |
Returns:
Type: BaseStyleProps['visibility']
Description: 元素可见性
Get element z-index
getElementZIndex(id: ID): number;
Parameter | Type | Description |
---|---|---|
id | string | 元素 ID |
Returns:
Type: number
Description: 元素层级
Hide element
hideElement(id: ID | ID[], animation?: boolean): Promise<void>;
Parameter | Type | Description |
---|---|---|
id | string | string[] | 元素 ID |
animation | boolean | 是否启用动画 |
Returns:
Set combo mapper
setCombo(combo: ComboOptions): void;
The value of options.combo
Parameter | Type | Description |
---|---|---|
combo | 组合配置 |
Returns:
Set edge mapper
setEdge(edge: EdgeOptions): void;
The value of options.edge
Parameter | Type | Description |
---|---|---|
edge | 边配置 |
Returns:
Set element state
setElementState(id: ID, state: State | State[], animation?: boolean): Promise<void>;
Parameter | Type | Description |
---|---|---|
id | string | 元素 ID |
state | string | string[] | 状态 |
animation | boolean | 动画配置 |
Returns:
Batch set element state
setElementState(state: Record<ID, State | State[]>, animation?: boolean): Promise<void>;
Parameter | Type | Description |
---|---|---|
state | Record<string, string | string[]> | 状态配置 |
animation | boolean | 动画配置 |
Returns:
Set element visibility
setElementVisibility(id: ID, visibility: BaseStyleProps['visibility'], animation?: boolean): Promise<void>;
Visibility configuration includes two states: visible
and hidden
Parameter | Type | Description |
---|---|---|
id | string | 元素 ID |
visibility | BaseStyleProps['visibility'] | 可见性 |
animation | boolean | 动画配置 |
Returns:
Batch set element visibility
setElementVisibility(visibility: Record<ID, BaseStyleProps['visibility']>, animation?: boolean): Promise<void>;
Parameter | Type | Description |
---|---|---|
visibility | Record<string, BaseStyleProps['visibility']> | 可见性配置 |
animation | boolean | 动画配置 |
Returns:
Set element z-index
setElementZIndex(id: ID, zIndex: number): Promise<void>;
Parameter | Type | Description |
---|---|---|
id | string | 元素 ID |
zIndex | number | 层级 |
Returns:
Batch set element z-index
setElementZIndex(zIndex: Record<ID, number>): Promise<void>;
Parameter | Type | Description |
---|---|---|
zIndex | Record<string, number> | 层级配置 |
Returns:
Set node mapper
setNode(node: NodeOptions): void;
The value of options.node
Parameter | Type | Description |
---|---|---|
node | 节点配置 |
Returns:
Show element
showElement(id: ID | ID[], animation?: boolean): Promise<void>;
Parameter | Type | Description |
---|---|---|
id | string | string[] | 元素 ID |
animation | boolean | 是否启用动画 |
Returns:
Translate the element by the specified distance (relative translation)
translateElementBy(id: ID, offset: Point, animation?: boolean): Promise<void>;
Parameter | Type | Description |
---|---|---|
id | string | 元素 ID |
offset | [number, number] | [number, number, number] | Float32Array | 偏移量 |
animation | boolean | 是否启用动画 |
Returns:
Batch translate elements by the specified distance (relative translation)
translateElementBy(offsets: Record<ID, Point>, animation?: boolean): Promise<void>;
Parameter | Type | Description |
---|---|---|
offsets | Record<string, [number, number] | [number, number, number] | Float32Array> | 偏移量配置 |
animation | boolean | 是否启用动画 |
Returns:
Translate the element to the specified position (absolute translation)
translateElementTo(id: ID, position: Point, animation?: boolean): Promise<void>;
Parameter | Type | Description |
---|---|---|
id | string | 元素 ID |
position | [number, number] | [number, number, number] | Float32Array | 指定位置 |
animation | boolean | 是否启用动画 |
Returns:
Batch translate elements to the specified position (absolute translation)
translateElementTo(positions: Record<ID, Point>, animation?: boolean): Promise<void>;
Parameter | Type | Description |
---|---|---|
positions | Record<string, [number, number] | [number, number, number] | Float32Array> | 位置配置 |
animation | boolean | 是否启用动画 |
Returns:
Focus on element
focusElement(id: ID | ID[], animation?: ViewportAnimationEffectTiming): Promise<void>;
Move the graph so that the element is aligned to the center of the viewport
Parameter | Type | Description |
---|---|---|
id | string | string[] | 元素 ID |
animation | 动画配置 |
Returns: