@antv/g6 5.0.32 → 5.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -34
- package/README.zh-CN.md +117 -0
- package/dist/g6.min.js +29 -29
- package/dist/lib/behaviors/collapse-expand.d.ts +6 -0
- package/dist/lib/behaviors/drag-element.d.ts +1 -1
- package/dist/lib/behaviors/optimize-viewport-transform.d.ts +1 -1
- package/dist/lib/elements/edges/base-edge.d.ts +5 -5
- package/dist/lib/elements/nodes/base-node.d.ts +2 -0
- package/dist/lib/elements/nodes/html.d.ts +4 -0
- package/dist/lib/elements/shapes/base-shape.d.ts +2 -2
- package/dist/lib/exports.d.ts +3 -2
- package/dist/lib/layouts/fishbone.d.ts +2 -1
- package/dist/lib/layouts/index.d.ts +2 -0
- package/dist/lib/layouts/snake.d.ts +80 -0
- package/dist/lib/layouts/types.d.ts +3 -1
- package/dist/lib/plugins/minimap/index.d.ts +1 -1
- package/dist/lib/plugins/snapline/index.d.ts +1 -1
- package/dist/lib/runtime/data.d.ts +1 -1
- package/dist/lib/runtime/element.d.ts +29 -2
- package/dist/lib/runtime/graph.d.ts +11 -9
- package/dist/lib/runtime/viewport.d.ts +22 -2
- package/dist/lib/spec/canvas.d.ts +26 -2
- package/dist/lib/spec/data.d.ts +2 -2
- package/dist/lib/spec/graph.d.ts +60 -12
- package/dist/lib/spec/viewport.d.ts +4 -0
- package/dist/lib/utils/cache.d.ts +5 -5
- package/dist/lib/utils/event/events.d.ts +4 -4
- package/dist/lib/utils/id.d.ts +1 -1
- package/dist/lib/utils/style.d.ts +5 -5
- package/dist/lib/utils/visibility.d.ts +1 -2
- package/dist/lib/version.d.ts +1 -1
- package/esm/behaviors/collapse-expand.d.ts +6 -0
- package/esm/behaviors/collapse-expand.js +4 -3
- package/esm/behaviors/collapse-expand.js.map +1 -1
- package/esm/behaviors/drag-element.d.ts +1 -1
- package/esm/behaviors/optimize-viewport-transform.d.ts +1 -1
- package/esm/behaviors/optimize-viewport-transform.js +1 -1
- package/esm/behaviors/optimize-viewport-transform.js.map +1 -1
- package/esm/elements/edges/base-edge.d.ts +5 -5
- package/esm/elements/nodes/base-node.d.ts +2 -0
- package/esm/elements/nodes/base-node.js +2 -2
- package/esm/elements/nodes/base-node.js.map +1 -1
- package/esm/elements/nodes/html.d.ts +4 -0
- package/esm/elements/nodes/html.js +7 -0
- package/esm/elements/nodes/html.js.map +1 -1
- package/esm/elements/shapes/base-shape.d.ts +2 -2
- package/esm/elements/shapes/base-shape.js +3 -3
- package/esm/elements/shapes/base-shape.js.map +1 -1
- package/esm/exports.d.ts +3 -2
- package/esm/exports.js +1 -1
- package/esm/exports.js.map +1 -1
- package/esm/layouts/fishbone.d.ts +2 -1
- package/esm/layouts/fishbone.js +1 -1
- package/esm/layouts/fishbone.js.map +1 -1
- package/esm/layouts/index.d.ts +2 -0
- package/esm/layouts/index.js +1 -0
- package/esm/layouts/index.js.map +1 -1
- package/esm/layouts/snake.d.ts +80 -0
- package/esm/layouts/snake.js +162 -0
- package/esm/layouts/snake.js.map +1 -0
- package/esm/layouts/types.d.ts +3 -1
- package/esm/plugins/hull/util.js +6 -1
- package/esm/plugins/hull/util.js.map +1 -1
- package/esm/plugins/minimap/index.d.ts +1 -1
- package/esm/plugins/snapline/index.d.ts +1 -1
- package/esm/preset.js +0 -2
- package/esm/preset.js.map +1 -1
- package/esm/registry/build-in.js +2 -1
- package/esm/registry/build-in.js.map +1 -1
- package/esm/runtime/data.d.ts +1 -1
- package/esm/runtime/data.js +8 -3
- package/esm/runtime/data.js.map +1 -1
- package/esm/runtime/element.d.ts +29 -2
- package/esm/runtime/element.js +34 -4
- package/esm/runtime/element.js.map +1 -1
- package/esm/runtime/graph.d.ts +11 -9
- package/esm/runtime/graph.js +20 -15
- package/esm/runtime/graph.js.map +1 -1
- package/esm/runtime/viewport.d.ts +22 -2
- package/esm/runtime/viewport.js +12 -11
- package/esm/runtime/viewport.js.map +1 -1
- package/esm/spec/canvas.d.ts +26 -2
- package/esm/spec/data.d.ts +2 -2
- package/esm/spec/graph.d.ts +60 -12
- package/esm/spec/viewport.d.ts +4 -0
- package/esm/transforms/place-radial-labels.js +6 -1
- package/esm/transforms/place-radial-labels.js.map +1 -1
- package/esm/utils/cache.d.ts +5 -5
- package/esm/utils/cache.js +5 -5
- package/esm/utils/event/events.d.ts +4 -4
- package/esm/utils/id.d.ts +1 -1
- package/esm/utils/style.d.ts +5 -5
- package/esm/utils/style.js +5 -5
- package/esm/utils/visibility.d.ts +1 -2
- package/esm/utils/visibility.js +8 -34
- package/esm/utils/visibility.js.map +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/lib/behaviors/collapse-expand.d.ts +6 -0
- package/lib/behaviors/collapse-expand.js +4 -3
- package/lib/behaviors/collapse-expand.js.map +1 -1
- package/lib/behaviors/drag-element.d.ts +1 -1
- package/lib/behaviors/optimize-viewport-transform.d.ts +1 -1
- package/lib/behaviors/optimize-viewport-transform.js +1 -1
- package/lib/behaviors/optimize-viewport-transform.js.map +1 -1
- package/lib/elements/edges/base-edge.d.ts +5 -5
- package/lib/elements/edges/base-edge.js +17 -7
- package/lib/elements/edges/base-edge.js.map +1 -1
- package/lib/elements/nodes/base-node.d.ts +2 -0
- package/lib/elements/nodes/base-node.js +2 -2
- package/lib/elements/nodes/base-node.js.map +1 -1
- package/lib/elements/nodes/html.d.ts +4 -0
- package/lib/elements/nodes/html.js +7 -0
- package/lib/elements/nodes/html.js.map +1 -1
- package/lib/elements/shapes/base-shape.d.ts +2 -2
- package/lib/elements/shapes/base-shape.js +3 -3
- package/lib/elements/shapes/base-shape.js.map +1 -1
- package/lib/exports.d.ts +3 -2
- package/lib/exports.js +3 -2
- package/lib/exports.js.map +1 -1
- package/lib/layouts/fishbone.d.ts +2 -1
- package/lib/layouts/fishbone.js +2 -2
- package/lib/layouts/fishbone.js.map +1 -1
- package/lib/layouts/index.d.ts +2 -0
- package/lib/layouts/index.js +3 -1
- package/lib/layouts/index.js.map +1 -1
- package/lib/layouts/snake.d.ts +80 -0
- package/lib/layouts/snake.js +166 -0
- package/lib/layouts/snake.js.map +1 -0
- package/lib/layouts/types.d.ts +3 -1
- package/lib/plugins/hull/util.js +5 -0
- package/lib/plugins/hull/util.js.map +1 -1
- package/lib/plugins/minimap/index.d.ts +1 -1
- package/lib/plugins/snapline/index.d.ts +1 -1
- package/lib/preset.js +0 -2
- package/lib/preset.js.map +1 -1
- package/lib/registry/build-in.js +1 -0
- package/lib/registry/build-in.js.map +1 -1
- package/lib/runtime/data.d.ts +1 -1
- package/lib/runtime/data.js +7 -2
- package/lib/runtime/data.js.map +1 -1
- package/lib/runtime/element.d.ts +29 -2
- package/lib/runtime/element.js +34 -4
- package/lib/runtime/element.js.map +1 -1
- package/lib/runtime/graph.d.ts +11 -9
- package/lib/runtime/graph.js +20 -15
- package/lib/runtime/graph.js.map +1 -1
- package/lib/runtime/viewport.d.ts +22 -2
- package/lib/runtime/viewport.js +12 -11
- package/lib/runtime/viewport.js.map +1 -1
- package/lib/spec/canvas.d.ts +26 -2
- package/lib/spec/data.d.ts +2 -2
- package/lib/spec/graph.d.ts +60 -12
- package/lib/spec/viewport.d.ts +4 -0
- package/lib/transforms/place-radial-labels.js +6 -1
- package/lib/transforms/place-radial-labels.js.map +1 -1
- package/lib/utils/cache.d.ts +5 -5
- package/lib/utils/cache.js +5 -5
- package/lib/utils/event/events.d.ts +4 -4
- package/lib/utils/id.d.ts +1 -1
- package/lib/utils/style.d.ts +5 -5
- package/lib/utils/style.js +5 -5
- package/lib/utils/visibility.d.ts +1 -2
- package/lib/utils/visibility.js +8 -34
- package/lib/utils/visibility.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +8 -8
- package/src/behaviors/collapse-expand.ts +10 -3
- package/src/behaviors/optimize-viewport-transform.ts +2 -2
- package/src/elements/edges/base-edge.ts +5 -5
- package/src/elements/nodes/base-node.ts +4 -2
- package/src/elements/nodes/html.ts +9 -0
- package/src/elements/shapes/base-shape.ts +3 -3
- package/src/exports.ts +3 -1
- package/src/layouts/fishbone.ts +3 -2
- package/src/layouts/index.ts +3 -0
- package/src/layouts/snake.ts +235 -0
- package/src/layouts/types.ts +5 -1
- package/src/plugins/hull/util.ts +7 -1
- package/src/plugins/minimap/index.ts +1 -1
- package/src/preset.ts +0 -3
- package/src/registry/build-in.ts +2 -0
- package/src/runtime/data.ts +11 -4
- package/src/runtime/element.ts +51 -4
- package/src/runtime/graph.ts +21 -17
- package/src/runtime/viewport.ts +36 -10
- package/src/spec/canvas.ts +26 -2
- package/src/spec/data.ts +2 -2
- package/src/spec/graph.ts +60 -12
- package/src/spec/viewport.ts +4 -0
- package/src/transforms/place-radial-labels.ts +5 -1
- package/src/utils/cache.ts +5 -5
- package/src/utils/style.ts +5 -5
- package/src/utils/visibility.ts +6 -35
- package/src/version.ts +1 -1
- package/README.en-US.md +0 -118
package/src/layouts/types.ts
CHANGED
|
@@ -17,6 +17,8 @@ import type {
|
|
|
17
17
|
} from '@antv/layout';
|
|
18
18
|
import type { NodeData } from '../spec/data';
|
|
19
19
|
import type { BaseLayout } from './base-layout';
|
|
20
|
+
import type { FishboneLayoutOptions } from './fishbone';
|
|
21
|
+
import type { SnakeLayoutOptions } from './snake';
|
|
20
22
|
|
|
21
23
|
export type BuiltInLayoutOptions =
|
|
22
24
|
| AntVDagreLayout
|
|
@@ -31,7 +33,9 @@ export type BuiltInLayoutOptions =
|
|
|
31
33
|
| GridLayout
|
|
32
34
|
| MDSLayout
|
|
33
35
|
| RadialLayout
|
|
34
|
-
| RandomLayout
|
|
36
|
+
| RandomLayout
|
|
37
|
+
| SnakeLayoutOptions
|
|
38
|
+
| FishboneLayoutOptions;
|
|
35
39
|
|
|
36
40
|
export interface BaseLayoutOptions extends AnimationOptions, WebWorkerLayoutOptions, Record<string, any> {
|
|
37
41
|
/**
|
package/src/plugins/hull/util.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type PathArray } from '@antv/util';
|
|
|
2
2
|
import type { Point, Vector2 } from '../../types';
|
|
3
3
|
import { getLinesIntersection } from '../../utils/line';
|
|
4
4
|
import { getClosedSpline } from '../../utils/path';
|
|
5
|
-
import { sortByClockwise } from '../../utils/point';
|
|
5
|
+
import { isCollinear, sortByClockwise } from '../../utils/point';
|
|
6
6
|
import { add, angle, normalize, perpendicular, scale, subtract, toVector2, toVector3 } from '../../utils/vector';
|
|
7
7
|
import type { HullOptions } from '../hull';
|
|
8
8
|
|
|
@@ -18,6 +18,11 @@ import type { HullOptions } from '../hull';
|
|
|
18
18
|
export function computeHullPath(points: Point[], padding: number, corner: 'rounded' | 'smooth' | 'sharp'): PathArray {
|
|
19
19
|
if (points.length === 1) return genSinglePointHullPath(points[0], padding, corner);
|
|
20
20
|
if (points.length === 2) return genTwoPointsHullPath(points, padding, corner);
|
|
21
|
+
if (points.length === 3) {
|
|
22
|
+
const [p1, p2, p3] = sortByClockwise(points);
|
|
23
|
+
if (isCollinear(p1, p2, p3)) return genTwoPointsHullPath([p1, p3], padding, corner);
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
switch (corner) {
|
|
22
27
|
case 'smooth':
|
|
23
28
|
return genMultiPointsSmoothHull(points, padding);
|
|
@@ -134,6 +139,7 @@ const genMultiPointsRoundedHull = (points: Point[], padding: number): PathArray
|
|
|
134
139
|
},
|
|
135
140
|
];
|
|
136
141
|
});
|
|
142
|
+
|
|
137
143
|
const arcData = [padding, padding, 0, 0, 0];
|
|
138
144
|
const startIndex = segments.findIndex(
|
|
139
145
|
(segment, i) =>
|
|
@@ -58,7 +58,7 @@ export interface MinimapOptions extends BasePluginOptions {
|
|
|
58
58
|
* - 也可以传入一个函数,接收元素的 id 和类型,返回一个图形
|
|
59
59
|
*
|
|
60
60
|
* <en/>
|
|
61
|
-
* - 'key' uses the key shape of the element as the thumbnail
|
|
61
|
+
* - 'key' uses the key shape of the element as the thumbnail shape
|
|
62
62
|
* - You can also pass in a function that receives the id and type of the element and returns a shape
|
|
63
63
|
*/
|
|
64
64
|
shape?: 'key' | ((id: string, elementType: ElementType) => DisplayObject);
|
package/src/preset.ts
CHANGED
package/src/registry/build-in.ts
CHANGED
|
@@ -65,6 +65,7 @@ import {
|
|
|
65
65
|
MDSLayout,
|
|
66
66
|
RadialLayout,
|
|
67
67
|
RandomLayout,
|
|
68
|
+
SnakeLayout,
|
|
68
69
|
compactBox,
|
|
69
70
|
dendrogram,
|
|
70
71
|
indented,
|
|
@@ -167,6 +168,7 @@ const BUILT_IN_EXTENSIONS: ExtensionRegistry = {
|
|
|
167
168
|
mindmap,
|
|
168
169
|
radial: RadialLayout,
|
|
169
170
|
random: RandomLayout,
|
|
171
|
+
snake: SnakeLayout,
|
|
170
172
|
},
|
|
171
173
|
node: {
|
|
172
174
|
circle: Circle,
|
package/src/runtime/data.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Graph as GraphLib } from '@antv/graphlib';
|
|
2
|
-
import {
|
|
2
|
+
import { isNil, isNumber, uniq } from '@antv/util';
|
|
3
3
|
import { COMBO_KEY, ChangeType, TREE_KEY } from '../constants';
|
|
4
4
|
import type { ComboData, EdgeData, GraphData, NodeData } from '../spec';
|
|
5
5
|
import type {
|
|
@@ -518,8 +518,15 @@ export class DataController {
|
|
|
518
518
|
const id = idOf(datum);
|
|
519
519
|
const parent = parentIdOf(datum);
|
|
520
520
|
|
|
521
|
-
if (parent) {
|
|
521
|
+
if (parent !== undefined) {
|
|
522
522
|
if (!model.hasTreeStructure(COMBO_KEY)) model.attachTreeStructure(COMBO_KEY);
|
|
523
|
+
|
|
524
|
+
// 解除原父节点的子节点关系,更新原父节点及其祖先的数据
|
|
525
|
+
// Remove the child relationship of the original parent node, update the data of the original parent node and its ancestors
|
|
526
|
+
if (parent === null) {
|
|
527
|
+
this.refreshComboData(id);
|
|
528
|
+
}
|
|
529
|
+
|
|
523
530
|
this.setParent(id, parentIdOf(datum), COMBO_KEY);
|
|
524
531
|
}
|
|
525
532
|
|
|
@@ -665,7 +672,7 @@ export class DataController {
|
|
|
665
672
|
* @param hierarchyKey - <zh/> 层次结构类型 | <en/> hierarchy type
|
|
666
673
|
* @param update - <zh/> 添加新/旧父节点数据更新记录 | <en/> add new/old parent node data update record
|
|
667
674
|
*/
|
|
668
|
-
public setParent(id: ID, parent: ID | undefined, hierarchyKey: HierarchyKey, update: boolean = true) {
|
|
675
|
+
public setParent(id: ID, parent: ID | undefined | null, hierarchyKey: HierarchyKey, update: boolean = true) {
|
|
669
676
|
if (id === parent) return;
|
|
670
677
|
const elementData = this.getNodeLikeDatum(id);
|
|
671
678
|
const originalParentId = parentIdOf(elementData);
|
|
@@ -891,7 +898,7 @@ export class DataController {
|
|
|
891
898
|
this.model.mergeNodeData(idOf(childData), value);
|
|
892
899
|
});
|
|
893
900
|
|
|
894
|
-
if (!
|
|
901
|
+
if (!isNil(grandParent)) this.refreshComboData(grandParent);
|
|
895
902
|
}
|
|
896
903
|
}
|
|
897
904
|
|
package/src/runtime/element.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { groupBy } from '@antv/util';
|
|
|
6
6
|
import { AnimationType, COMBO_KEY, ChangeType, GraphEvent } from '../constants';
|
|
7
7
|
import { ELEMENT_TYPES } from '../constants/element';
|
|
8
8
|
import { getExtension } from '../registry/get';
|
|
9
|
-
import type { ComboData, EdgeData, NodeData } from '../spec';
|
|
9
|
+
import type { ComboData, EdgeData, GraphData, NodeData } from '../spec';
|
|
10
10
|
import type { AnimationStage } from '../spec/element/animation';
|
|
11
11
|
import type { DrawData, ProcedureData } from '../transforms/types';
|
|
12
12
|
import type {
|
|
@@ -35,6 +35,7 @@ import { positionOf } from '../utils/position';
|
|
|
35
35
|
import { print } from '../utils/print';
|
|
36
36
|
import { computeElementCallbackStyle } from '../utils/style';
|
|
37
37
|
import { themeOf } from '../utils/theme';
|
|
38
|
+
import { subtract } from '../utils/vector';
|
|
38
39
|
import { setVisibility } from '../utils/visibility';
|
|
39
40
|
import type { RuntimeContext } from './types';
|
|
40
41
|
|
|
@@ -590,6 +591,28 @@ export class ElementController {
|
|
|
590
591
|
delete this.shapeTypeMap[id];
|
|
591
592
|
}
|
|
592
593
|
|
|
594
|
+
/**
|
|
595
|
+
* <zh/> 将布局结果对齐到元素,避免视图偏移。会修改布局结果
|
|
596
|
+
*
|
|
597
|
+
* <en/> Align the layout result to the element to avoid view offset. Will modify the layout result
|
|
598
|
+
* @param layoutResult - <zh/> 布局结果 | <en/> layout result
|
|
599
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
600
|
+
*/
|
|
601
|
+
private alignLayoutResultToElement(layoutResult: GraphData, id: ID) {
|
|
602
|
+
const target = layoutResult.nodes?.find((node) => idOf(node) === id);
|
|
603
|
+
|
|
604
|
+
if (target) {
|
|
605
|
+
const originalPosition = positionOf(this.context.model.getNodeLikeDatum(id));
|
|
606
|
+
const modifiedPosition = positionOf(target);
|
|
607
|
+
const delta = subtract(originalPosition, modifiedPosition);
|
|
608
|
+
layoutResult.nodes?.forEach((node) => {
|
|
609
|
+
if (node.style?.x) node.style.x += delta[0];
|
|
610
|
+
if (node.style?.y) node.style.y += delta[1];
|
|
611
|
+
if (node.style?.z) node.style.z += delta[2] || 0;
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
|
|
593
616
|
/**
|
|
594
617
|
* <zh/> 收起节点
|
|
595
618
|
*
|
|
@@ -597,7 +620,9 @@ export class ElementController {
|
|
|
597
620
|
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
598
621
|
* @param animation - <zh/> 是否使用动画,默认为 true | <en/> Whether to use animation, default is true
|
|
599
622
|
*/
|
|
600
|
-
public async collapseNode(id: ID,
|
|
623
|
+
public async collapseNode(id: ID, options: CollapseExpandNodeOptions): Promise<void> {
|
|
624
|
+
const { animation, align } = options;
|
|
625
|
+
|
|
601
626
|
const { model, layout } = this.context;
|
|
602
627
|
|
|
603
628
|
const preLayoutData = this.computeChangesAndDrawData({ stage: 'collapse', animation });
|
|
@@ -608,6 +633,7 @@ export class ElementController {
|
|
|
608
633
|
// 进行预布局,计算出所有元素的位置
|
|
609
634
|
// Perform pre-layout to calculate the position of all elements
|
|
610
635
|
const result = await layout!.simulate();
|
|
636
|
+
if (align) this.alignLayoutResultToElement(result, id);
|
|
611
637
|
model.updateData(result);
|
|
612
638
|
|
|
613
639
|
// 重新计算数据 / Recalculate data
|
|
@@ -647,9 +673,9 @@ export class ElementController {
|
|
|
647
673
|
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
648
674
|
* @param animation - <zh/> 是否使用动画,默认为 true | <en/> Whether to use animation, default is true
|
|
649
675
|
*/
|
|
650
|
-
public async expandNode(id: ID,
|
|
676
|
+
public async expandNode(id: ID, options: CollapseExpandNodeOptions): Promise<void> {
|
|
651
677
|
const { model, layout } = this.context;
|
|
652
|
-
|
|
678
|
+
const { animation, align } = options;
|
|
653
679
|
|
|
654
680
|
const position = positionOf(model.getNodeData([id])[0]);
|
|
655
681
|
|
|
@@ -666,6 +692,7 @@ export class ElementController {
|
|
|
666
692
|
this.context.animation!.clear();
|
|
667
693
|
|
|
668
694
|
const result = await layout!.simulate();
|
|
695
|
+
if (align) this.alignLayoutResultToElement(result, id);
|
|
669
696
|
model.updateData(result);
|
|
670
697
|
|
|
671
698
|
// 重新计算数据 / Recalculate data
|
|
@@ -809,3 +836,23 @@ export interface DrawContext {
|
|
|
809
836
|
/** <zh/> 展开阶段的目标元素 id | <en/> ID of the target element in the expand stage */
|
|
810
837
|
target?: ID;
|
|
811
838
|
}
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* <zh/> 展开/收起节点选项
|
|
842
|
+
*
|
|
843
|
+
* <en/> Expand / collapse node options
|
|
844
|
+
*/
|
|
845
|
+
export interface CollapseExpandNodeOptions {
|
|
846
|
+
/**
|
|
847
|
+
* <zh/> 是否使用动画
|
|
848
|
+
*
|
|
849
|
+
* <en/> Whether to use animation
|
|
850
|
+
*/
|
|
851
|
+
animation?: boolean;
|
|
852
|
+
/**
|
|
853
|
+
* <zh/> 保证展开/收起的节点位置不变
|
|
854
|
+
*
|
|
855
|
+
* <en/> Ensure that the position of the expanded/collapsed node remains unchanged
|
|
856
|
+
*/
|
|
857
|
+
align?: boolean;
|
|
858
|
+
}
|
package/src/runtime/graph.ts
CHANGED
|
@@ -53,6 +53,7 @@ import { BehaviorController } from './behavior';
|
|
|
53
53
|
import type { DataURLOptions } from './canvas';
|
|
54
54
|
import { Canvas } from './canvas';
|
|
55
55
|
import { DataController } from './data';
|
|
56
|
+
import type { CollapseExpandNodeOptions } from './element';
|
|
56
57
|
import { ElementController } from './element';
|
|
57
58
|
import { LayoutController } from './layout';
|
|
58
59
|
import { PluginController } from './plugin';
|
|
@@ -424,7 +425,7 @@ export class Graph extends EventEmitter {
|
|
|
424
425
|
* <zh/> 获取插件实例
|
|
425
426
|
*
|
|
426
427
|
* <en/> Get plugin instance
|
|
427
|
-
* @param key - <zh/> 插件 key | <en/> plugin key
|
|
428
|
+
* @param key - <zh/> 插件 key(在配置 plugin 时需要手动传入指定) | <en/> plugin key(need to be specified manually when configuring plugin)
|
|
428
429
|
* @returns <zh/> 插件实例 | <en/> plugin instance
|
|
429
430
|
* @remarks
|
|
430
431
|
* <zh/> 一些插件提供了 API 方法可供调用,例如全屏插件可以调用 `request` 和 `exit` 方法来请求和退出全屏
|
|
@@ -1286,7 +1287,7 @@ export class Graph extends EventEmitter {
|
|
|
1286
1287
|
* @apiCategory viewport
|
|
1287
1288
|
*/
|
|
1288
1289
|
public async fitCenter(animation?: ViewportAnimationEffectTiming): Promise<void> {
|
|
1289
|
-
await this.context.viewport?.fitCenter(animation);
|
|
1290
|
+
await this.context.viewport?.fitCenter({ animation });
|
|
1290
1291
|
}
|
|
1291
1292
|
|
|
1292
1293
|
private async autoFit(): Promise<void> {
|
|
@@ -1316,7 +1317,7 @@ export class Graph extends EventEmitter {
|
|
|
1316
1317
|
* @apiCategory viewport
|
|
1317
1318
|
*/
|
|
1318
1319
|
public async focusElement(id: ID | ID[], animation?: ViewportAnimationEffectTiming): Promise<void> {
|
|
1319
|
-
await this.context.viewport?.focusElements(Array.isArray(id) ? id : [id], animation);
|
|
1320
|
+
await this.context.viewport?.focusElements(Array.isArray(id) ? id : [id], { animation });
|
|
1320
1321
|
}
|
|
1321
1322
|
|
|
1322
1323
|
/**
|
|
@@ -1782,50 +1783,53 @@ export class Graph extends EventEmitter {
|
|
|
1782
1783
|
private isCollapsingExpanding = false;
|
|
1783
1784
|
|
|
1784
1785
|
/**
|
|
1785
|
-
* <zh/>
|
|
1786
|
+
* <zh/> 收起元素
|
|
1786
1787
|
*
|
|
1787
|
-
* <en/> Collapse
|
|
1788
|
+
* <en/> Collapse element
|
|
1788
1789
|
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
1789
|
-
* @param
|
|
1790
|
+
* @param options - <zh/> 是否启用动画或者配置收起节点的配置项 | <en/> whether to enable animation or the options of collapsing node
|
|
1790
1791
|
* @apiCategory element
|
|
1791
1792
|
*/
|
|
1792
|
-
public async collapseElement(id: ID,
|
|
1793
|
+
public async collapseElement(id: ID, options: boolean | CollapseExpandNodeOptions = true): Promise<void> {
|
|
1793
1794
|
const { model, element } = this.context;
|
|
1794
1795
|
if (isCollapsed(model.getNodeLikeData([id])[0])) return;
|
|
1795
|
-
|
|
1796
1796
|
if (this.isCollapsingExpanding) return;
|
|
1797
1797
|
|
|
1798
|
+
if (typeof options === 'boolean') options = { animation: options, align: true };
|
|
1799
|
+
|
|
1798
1800
|
const elementType = model.getElementType(id);
|
|
1799
1801
|
|
|
1800
1802
|
await this.frontElement(id);
|
|
1801
1803
|
this.isCollapsingExpanding = true;
|
|
1802
1804
|
this.setElementCollapsibility(id, true);
|
|
1803
|
-
if (elementType === 'node') await element!.collapseNode(id,
|
|
1804
|
-
else if (elementType === 'combo') await element!.collapseCombo(id, animation);
|
|
1805
|
+
if (elementType === 'node') await element!.collapseNode(id, options);
|
|
1806
|
+
else if (elementType === 'combo') await element!.collapseCombo(id, !!options.animation);
|
|
1805
1807
|
|
|
1806
1808
|
this.isCollapsingExpanding = false;
|
|
1807
1809
|
}
|
|
1808
1810
|
|
|
1809
1811
|
/**
|
|
1810
|
-
* <zh/>
|
|
1812
|
+
* <zh/> 展开元素
|
|
1811
1813
|
*
|
|
1812
|
-
* <en/> Expand
|
|
1814
|
+
* <en/> Expand Element
|
|
1813
1815
|
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
1814
|
-
* @param animation - <zh/>
|
|
1816
|
+
* @param animation - <zh/> 是否启用动画或者配置收起节点的配置项 | <en/> whether to enable animation or the options of collapsing node
|
|
1817
|
+
* @param options
|
|
1815
1818
|
* @apiCategory element
|
|
1816
1819
|
*/
|
|
1817
|
-
public async expandElement(id: ID,
|
|
1820
|
+
public async expandElement(id: ID, options: boolean | CollapseExpandNodeOptions = true): Promise<void> {
|
|
1818
1821
|
const { model, element } = this.context;
|
|
1819
1822
|
if (!isCollapsed(model.getNodeLikeData([id])[0])) return;
|
|
1820
|
-
|
|
1821
1823
|
if (this.isCollapsingExpanding) return;
|
|
1822
1824
|
|
|
1825
|
+
if (typeof options === 'boolean') options = { animation: options, align: true };
|
|
1826
|
+
|
|
1823
1827
|
const elementType = model.getElementType(id);
|
|
1824
1828
|
|
|
1825
1829
|
this.isCollapsingExpanding = true;
|
|
1826
1830
|
this.setElementCollapsibility(id, false);
|
|
1827
|
-
if (elementType === 'node') await element!.expandNode(id,
|
|
1828
|
-
else if (elementType === 'combo') await element!.expandCombo(id, animation);
|
|
1831
|
+
if (elementType === 'node') await element!.expandNode(id, options);
|
|
1832
|
+
else if (elementType === 'combo') await element!.expandCombo(id, !!options.animation);
|
|
1829
1833
|
|
|
1830
1834
|
this.isCollapsingExpanding = false;
|
|
1831
1835
|
}
|
package/src/runtime/viewport.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { AABB, ICamera } from '@antv/g';
|
|
|
2
2
|
import { clamp, isNumber, pick } from '@antv/util';
|
|
3
3
|
import { AnimationType, GraphEvent } from '../constants';
|
|
4
4
|
import type { FitViewOptions, ID, Point, TransformOptions, Vector2, ViewportAnimationEffectTiming } from '../types';
|
|
5
|
+
import type { Element } from '../types/element';
|
|
5
6
|
import { getAnimationOptions } from '../utils/animation';
|
|
6
7
|
import { getBBoxSize, getCombinedBBox, getExpandedBBox, isBBoxInside, isPointInBBox } from '../utils/bbox';
|
|
7
8
|
import { AnimateEvent, ViewportEvent, emit } from '../utils/event';
|
|
@@ -217,7 +218,7 @@ export class ViewportController {
|
|
|
217
218
|
(direction === 'y' && contentHeight >= innerHeight) ||
|
|
218
219
|
(direction === 'both' && contentWidth >= innerWidth && contentHeight >= innerHeight);
|
|
219
220
|
|
|
220
|
-
if (when === 'overflow' && !isOverflow) return await this.fitCenter(animation);
|
|
221
|
+
if (when === 'overflow' && !isOverflow) return await this.fitCenter({ animation });
|
|
221
222
|
|
|
222
223
|
const scaleX = innerWidth / contentWidth;
|
|
223
224
|
const scaleY = innerHeight / contentHeight;
|
|
@@ -237,23 +238,27 @@ export class ViewportController {
|
|
|
237
238
|
);
|
|
238
239
|
}
|
|
239
240
|
|
|
240
|
-
public async fitCenter(
|
|
241
|
+
public async fitCenter(options: FocusOptions): Promise<void> {
|
|
241
242
|
const canvasBounds = this.context.canvas.getBounds();
|
|
242
|
-
await this.focus(canvasBounds,
|
|
243
|
+
await this.focus(canvasBounds, options);
|
|
243
244
|
}
|
|
244
245
|
|
|
245
|
-
public async focusElements(ids: ID[],
|
|
246
|
+
public async focusElements(ids: ID[], options: FocusOptions = {}): Promise<void> {
|
|
246
247
|
const { element } = this.context;
|
|
247
248
|
if (!element) return;
|
|
248
|
-
|
|
249
|
-
|
|
249
|
+
|
|
250
|
+
const getBoundsOf = (el: Element) =>
|
|
251
|
+
options.shapes ? el.getShape(options.shapes).getRenderBounds() : el.getRenderBounds();
|
|
252
|
+
|
|
253
|
+
const elementsBounds = getCombinedBBox(ids.map((id) => getBoundsOf(element.getElement(id)!)));
|
|
254
|
+
await this.focus(elementsBounds, options);
|
|
250
255
|
}
|
|
251
256
|
|
|
252
|
-
private async focus(bbox: AABB,
|
|
257
|
+
private async focus(bbox: AABB, options: FocusOptions) {
|
|
253
258
|
const center = this.context.graph.getViewportByCanvas(bbox.center);
|
|
254
|
-
const
|
|
255
|
-
const delta = subtract(
|
|
256
|
-
await this.transform({ mode: 'relative', translate: add(delta, this.paddingOffset) }, animation);
|
|
259
|
+
const position = options.position || this.getCanvasCenter();
|
|
260
|
+
const delta = subtract(position, center);
|
|
261
|
+
await this.transform({ mode: 'relative', translate: add(delta, this.paddingOffset) }, options.animation);
|
|
257
262
|
}
|
|
258
263
|
|
|
259
264
|
/**
|
|
@@ -312,3 +317,24 @@ export class ViewportController {
|
|
|
312
317
|
this.transformResolver?.();
|
|
313
318
|
}
|
|
314
319
|
}
|
|
320
|
+
|
|
321
|
+
export interface FocusOptions {
|
|
322
|
+
/**
|
|
323
|
+
* <zh/> 动画配置
|
|
324
|
+
*
|
|
325
|
+
* <en/> Animation configuration
|
|
326
|
+
*/
|
|
327
|
+
animation?: ViewportAnimationEffectTiming;
|
|
328
|
+
/**
|
|
329
|
+
* <zh/> 使用子图形计算包围盒
|
|
330
|
+
*
|
|
331
|
+
* <en/> Calculate the bounding box by using sub-shapes
|
|
332
|
+
*/
|
|
333
|
+
shapes?: string;
|
|
334
|
+
/**
|
|
335
|
+
* <zh/> 对齐位置,默认为画布中心
|
|
336
|
+
*
|
|
337
|
+
* <en/> Alignment position, default is the center of the canvas
|
|
338
|
+
*/
|
|
339
|
+
position?: Point;
|
|
340
|
+
}
|
package/src/spec/canvas.ts
CHANGED
|
@@ -18,18 +18,30 @@ export interface CanvasOptions {
|
|
|
18
18
|
* <zh/> 画布宽度
|
|
19
19
|
*
|
|
20
20
|
* <en/> canvas width
|
|
21
|
+
* @remarks
|
|
22
|
+
* <zh/> 如果未设置,则会自动获取容器宽度
|
|
23
|
+
*
|
|
24
|
+
* <en/> If not set, the container width will be automatically obtained
|
|
21
25
|
*/
|
|
22
26
|
width?: number;
|
|
23
27
|
/**
|
|
24
28
|
* <zh/> 画布高度
|
|
25
29
|
*
|
|
26
30
|
* <en/> canvas height
|
|
31
|
+
* @remarks
|
|
32
|
+
* <zh/> 如果未设置,则会自动获取容器高度
|
|
33
|
+
*
|
|
34
|
+
* <en/> If not set, the container height will be automatically obtained
|
|
27
35
|
*/
|
|
28
36
|
height?: number;
|
|
29
37
|
/**
|
|
30
|
-
* <zh/>
|
|
38
|
+
* <zh/> 手动置顶渲染器
|
|
39
|
+
*
|
|
40
|
+
* <en/> manually set renderer
|
|
41
|
+
* @remarks
|
|
42
|
+
* <zh/> G6 采用了分层渲染的方式,分为 background、main、label、transient 四层,用户可以通过该配置项分别设置每层画布的渲染器
|
|
31
43
|
*
|
|
32
|
-
* <en/>
|
|
44
|
+
* <en/> G6 adopts a layered rendering method, divided into four layers: background, main, label, transient. Users can set the renderer of each layer canvas separately through this configuration item
|
|
33
45
|
*/
|
|
34
46
|
renderer?: (layer: 'background' | 'main' | 'label' | 'transient') => IRenderer;
|
|
35
47
|
/**
|
|
@@ -37,18 +49,30 @@ export interface CanvasOptions {
|
|
|
37
49
|
*
|
|
38
50
|
* <en/> whether to auto resize canvas
|
|
39
51
|
* @defaultValue false
|
|
52
|
+
* @remarks
|
|
53
|
+
* <zh/> 基于 window.onresize 事件自动调整画布大小
|
|
54
|
+
*
|
|
55
|
+
* <en/> Automatically adjust the canvas size based on the window.onresize event
|
|
40
56
|
*/
|
|
41
57
|
autoResize?: boolean;
|
|
42
58
|
/**
|
|
43
59
|
* <zh/> 画布背景色
|
|
44
60
|
*
|
|
45
61
|
* <en/> canvas background color
|
|
62
|
+
* @remarks
|
|
63
|
+
* <zh/> 该颜色作为导出图片时的背景色
|
|
64
|
+
*
|
|
65
|
+
* <en/> This color is used as the background color when exporting images
|
|
46
66
|
*/
|
|
47
67
|
background?: string;
|
|
48
68
|
/**
|
|
49
69
|
* <zh/> 设备像素比
|
|
50
70
|
*
|
|
51
71
|
* <en/> device pixel ratio
|
|
72
|
+
* @remarks
|
|
73
|
+
* <zh/> 用于高清屏的设备像素比,默认为 [window.devicePixelRatio](https://developer.mozilla.org/zh-CN/docs/Web/API/Window/devicePixelRatio)
|
|
74
|
+
*
|
|
75
|
+
* <en/> Device pixel ratio for high-definition screens, default is [window.devicePixelRatio](https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio)
|
|
52
76
|
*/
|
|
53
77
|
devicePixelRatio?: number;
|
|
54
78
|
/**
|
package/src/spec/data.ts
CHANGED
|
@@ -92,7 +92,7 @@ export interface NodeData {
|
|
|
92
92
|
*
|
|
93
93
|
* <en/> ID of the combo to which the node belongs
|
|
94
94
|
*/
|
|
95
|
-
combo?: ID;
|
|
95
|
+
combo?: ID | null;
|
|
96
96
|
/**
|
|
97
97
|
* <zh/> 子节点 ID
|
|
98
98
|
*
|
|
@@ -161,7 +161,7 @@ export interface ComboData {
|
|
|
161
161
|
*
|
|
162
162
|
* <en/> ID of the combo to which the combo belongs
|
|
163
163
|
*/
|
|
164
|
-
combo?: ID;
|
|
164
|
+
combo?: ID | null;
|
|
165
165
|
[key: string]: unknown;
|
|
166
166
|
}
|
|
167
167
|
|
package/src/spec/graph.ts
CHANGED
|
@@ -40,30 +40,50 @@ export interface GraphOptions extends CanvasOptions, ViewportOptions {
|
|
|
40
40
|
* <zh/> 数据
|
|
41
41
|
*
|
|
42
42
|
* <en/> Data
|
|
43
|
+
* @remarks
|
|
44
|
+
* <zh/> 详见 [Data](/api/data/graph-data)
|
|
45
|
+
*
|
|
46
|
+
* <en/> See [Data](/en/api/data/graph-data)
|
|
43
47
|
*/
|
|
44
48
|
data?: GraphData;
|
|
45
49
|
/**
|
|
46
|
-
* <zh/>
|
|
50
|
+
* <zh/> 布局配置项
|
|
51
|
+
*
|
|
52
|
+
* <en/> Layout options
|
|
53
|
+
* @remarks
|
|
54
|
+
* <zh/> 详见 [Layout](/api/layouts/antv-dagre-layout)
|
|
47
55
|
*
|
|
48
|
-
* <en/> Layout
|
|
56
|
+
* <en/> See [Layout](/en/api/layouts/antv-dagre-layout)
|
|
49
57
|
*/
|
|
50
58
|
layout?: LayoutOptions;
|
|
51
59
|
/**
|
|
52
|
-
* <zh/>
|
|
60
|
+
* <zh/> 节点配置项
|
|
61
|
+
*
|
|
62
|
+
* <en/> Node options
|
|
63
|
+
* @remarks
|
|
64
|
+
* <zh/> 详见 [Node](/api/elements/nodes/base-node)
|
|
53
65
|
*
|
|
54
|
-
* <en/> Node
|
|
66
|
+
* <en/> See [Node](/en/api/elements/nodes/base-node)
|
|
55
67
|
*/
|
|
56
68
|
node?: NodeOptions;
|
|
57
69
|
/**
|
|
58
|
-
* <zh/>
|
|
70
|
+
* <zh/> 边配置项
|
|
59
71
|
*
|
|
60
|
-
* <en/> Edge
|
|
72
|
+
* <en/> Edge options
|
|
73
|
+
* @remarks
|
|
74
|
+
* <zh/> 详见 [Edge](/api/elements/edges/base-edge)
|
|
75
|
+
*
|
|
76
|
+
* <en/> See [Edge](/en/api/elements/edges/base-edge)
|
|
61
77
|
*/
|
|
62
78
|
edge?: EdgeOptions;
|
|
63
79
|
/**
|
|
64
|
-
* <zh/>
|
|
80
|
+
* <zh/> 组合配置项
|
|
65
81
|
*
|
|
66
|
-
* <en/> Combo
|
|
82
|
+
* <en/> Combo options
|
|
83
|
+
* @remarks
|
|
84
|
+
* <zh/> 详见 [Combo](/api/elements/combos/base-combo)
|
|
85
|
+
*
|
|
86
|
+
* <en/> See [Combo](/en/api/elements/combos/base-combo)
|
|
67
87
|
*/
|
|
68
88
|
combo?: ComboOptions;
|
|
69
89
|
/**
|
|
@@ -73,15 +93,43 @@ export interface GraphOptions extends CanvasOptions, ViewportOptions {
|
|
|
73
93
|
*/
|
|
74
94
|
theme?: ThemeOptions;
|
|
75
95
|
/**
|
|
76
|
-
* <zh/>
|
|
96
|
+
* <zh/> 启用交互
|
|
97
|
+
*
|
|
98
|
+
* <en/> Enable interactions
|
|
99
|
+
* @remarks
|
|
100
|
+
* <zh/>
|
|
101
|
+
* - 概念:[核心概念 - 交互](/manual/core-concept/behavior)
|
|
102
|
+
*
|
|
103
|
+
* - 内置交互: [交互](/api/behaviors/auto-adapt-label)
|
|
104
|
+
*
|
|
105
|
+
* - 自定义交互: [自定义扩展 - 自定义交互](/manual/advanced/custom-behavior)
|
|
77
106
|
*
|
|
78
|
-
* <en/>
|
|
107
|
+
* <en/>
|
|
108
|
+
* - Concept: [Concepts - Behavior](/en/manual/core-concept/behavior)
|
|
109
|
+
*
|
|
110
|
+
* - Built-in behaviors: [Behavior](/en/api/behaviors/auto-adapt-label)
|
|
111
|
+
*
|
|
112
|
+
* - Custom behaviors: [Custom Extension - Custom Behavior](/en/manual/advanced/custom-behavior)
|
|
79
113
|
*/
|
|
80
114
|
behaviors?: BehaviorOptions;
|
|
81
115
|
/**
|
|
82
|
-
* <zh/>
|
|
116
|
+
* <zh/> 启用插件
|
|
117
|
+
*
|
|
118
|
+
* <en/> Enable plugins
|
|
119
|
+
* @remarks
|
|
120
|
+
* <zh/>
|
|
121
|
+
* - 概念:[核心概念 - 插件](/manual/core-concept/plugin)
|
|
122
|
+
*
|
|
123
|
+
* - 内置插件: [插件](/en/api/plugins/background)
|
|
124
|
+
*
|
|
125
|
+
* - 自定义插件: [自定义扩展 - 自定义插件](/manual/advanced/custom-plugin)
|
|
126
|
+
*
|
|
127
|
+
* <en/>
|
|
128
|
+
* - Concept: [Concepts - Plugin](/en/manual/core-concept/plugin)
|
|
129
|
+
*
|
|
130
|
+
* - Built-in plugins: [Plugin](/en/api/plugins/background)
|
|
83
131
|
*
|
|
84
|
-
*
|
|
132
|
+
* - Custom plugins: [Custom Extension - Custom Plugin](/en/manual/advanced/custom-plugin)
|
|
85
133
|
*/
|
|
86
134
|
plugins?: PluginOptions;
|
|
87
135
|
/**
|
package/src/spec/viewport.ts
CHANGED
|
@@ -24,6 +24,10 @@ export interface ViewportOptions {
|
|
|
24
24
|
* <zh/> 是否自动适应
|
|
25
25
|
*
|
|
26
26
|
* <en/> whether to auto fit
|
|
27
|
+
* @remarks
|
|
28
|
+
* <zh/> 每次执行 `render` 时,都会根据 `autoFit` 进行自适应
|
|
29
|
+
*
|
|
30
|
+
* <en/> Every time `render` is executed, it will be adapted according to `autoFit`
|
|
27
31
|
*/
|
|
28
32
|
autoFit?:
|
|
29
33
|
| { type: 'view'; options?: FitViewOptions; animation?: ViewportAnimationEffectTiming }
|
|
@@ -54,7 +54,11 @@ export class PlaceRadialLabels extends BaseTransform<PlaceRadialLabelsOptions> {
|
|
|
54
54
|
const isLeft = Math.abs(radian) > Math.PI / 2;
|
|
55
55
|
|
|
56
56
|
const isLeaf = !datum.children || datum.children.length === 0;
|
|
57
|
-
const
|
|
57
|
+
const nodeId = idOf(datum);
|
|
58
|
+
const node = this.context.element?.getElement(nodeId);
|
|
59
|
+
if (!node || !node.isVisible()) return;
|
|
60
|
+
|
|
61
|
+
const nodeHalfWidth = parseSize(graph.getElementRenderStyle(nodeId).size)[0] / 2;
|
|
58
62
|
const offset = (isLeaf ? 1 : -1) * (nodeHalfWidth + this.options.offset);
|
|
59
63
|
|
|
60
64
|
const labelTransform: TransformArray = [
|
package/src/utils/cache.ts
CHANGED
|
@@ -8,8 +8,8 @@ const getStyleCacheKey = (name: string) => `__${name}__`;
|
|
|
8
8
|
/**
|
|
9
9
|
* <zh/> 缓存图形样式
|
|
10
10
|
*
|
|
11
|
-
* <en/> Cache
|
|
12
|
-
* @param element - <zh/> 图形元素 | <en/>
|
|
11
|
+
* <en/> Cache shape style
|
|
12
|
+
* @param element - <zh/> 图形元素 | <en/> shape element
|
|
13
13
|
* @param name - <zh/> 样式名 | <en/> style name
|
|
14
14
|
*/
|
|
15
15
|
export function cacheStyle(element: DisplayObject, name: string | string[]) {
|
|
@@ -24,7 +24,7 @@ export function cacheStyle(element: DisplayObject, name: string | string[]) {
|
|
|
24
24
|
* <zh/> 获取缓存的样式
|
|
25
25
|
*
|
|
26
26
|
* <en/> Get cached style
|
|
27
|
-
* @param element - <zh/> 图形元素 | <en/>
|
|
27
|
+
* @param element - <zh/> 图形元素 | <en/> shape element
|
|
28
28
|
* @param name - <zh/> 样式名 | <en/> style name
|
|
29
29
|
* @returns <zh/> 样式值 | <en/> style value
|
|
30
30
|
*/
|
|
@@ -36,7 +36,7 @@ export function getCachedStyle(element: DisplayObject, name: string) {
|
|
|
36
36
|
* <zh/> 是否有缓存的样式
|
|
37
37
|
*
|
|
38
38
|
* <en/> Whether there is a cached style
|
|
39
|
-
* @param element - <zh/> 图形元素 | <en/>
|
|
39
|
+
* @param element - <zh/> 图形元素 | <en/> shape element
|
|
40
40
|
* @param name - <zh/> 样式名 | <en/> style name
|
|
41
41
|
* @returns <zh/> 是否有缓存的样式 | <en/> Whether there is a cached style
|
|
42
42
|
*/
|
|
@@ -48,7 +48,7 @@ export function hasCachedStyle(element: DisplayObject, name: string) {
|
|
|
48
48
|
* <zh/> 设置缓存的样式
|
|
49
49
|
*
|
|
50
50
|
* <en/> Set cached style
|
|
51
|
-
* @param element - <zh/> 图形元素 | <en/>
|
|
51
|
+
* @param element - <zh/> 图形元素 | <en/> shape element
|
|
52
52
|
* @param name - <zh/> 样式名 | <en/> style name
|
|
53
53
|
* @param value - <zh/> 样式值 | <en/> style value
|
|
54
54
|
*/
|