@antv/g6 5.0.9 → 5.0.11
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/dist/g6.min.js +2 -2
- package/dist/lib/behaviors/drag-canvas.d.ts +1 -0
- package/dist/lib/behaviors/fix-element-size.d.ts +88 -0
- package/dist/lib/behaviors/index.d.ts +4 -0
- package/dist/lib/behaviors/optimize-viewport-transform.d.ts +54 -0
- package/dist/lib/constants/events/graph.d.ts +13 -1
- package/dist/lib/exports.d.ts +7 -5
- package/dist/lib/plugins/history/index.d.ts +3 -4
- package/dist/lib/plugins/index.d.ts +2 -0
- package/dist/lib/plugins/minimap/index.d.ts +131 -0
- package/dist/lib/registry/build-in.d.ts +4 -4
- package/dist/lib/registry/get.d.ts +22 -0
- package/dist/lib/registry/{index.d.ts → register.d.ts} +1 -26
- package/dist/lib/registry/store.d.ts +7 -0
- package/dist/lib/runtime/canvas.d.ts +28 -7
- package/dist/lib/runtime/element.d.ts +3 -1
- package/dist/lib/runtime/graph.d.ts +5 -5
- package/dist/lib/utils/animation.d.ts +1 -1
- package/dist/lib/utils/bbox.d.ts +10 -0
- package/dist/lib/utils/event/events.d.ts +4 -4
- package/dist/lib/utils/visibility.d.ts +2 -1
- package/dist/lib/version.d.ts +1 -1
- package/esm/behaviors/create-edge.js +6 -4
- package/esm/behaviors/create-edge.js.map +1 -1
- package/esm/behaviors/drag-canvas.d.ts +1 -0
- package/esm/behaviors/drag-canvas.js +20 -14
- package/esm/behaviors/drag-canvas.js.map +1 -1
- package/esm/behaviors/fix-element-size.d.ts +88 -0
- package/esm/behaviors/fix-element-size.js +107 -0
- package/esm/behaviors/fix-element-size.js.map +1 -0
- package/esm/behaviors/hover-activate.js +5 -1
- package/esm/behaviors/hover-activate.js.map +1 -1
- package/esm/behaviors/index.d.ts +4 -0
- package/esm/behaviors/index.js +2 -0
- package/esm/behaviors/index.js.map +1 -1
- package/esm/behaviors/optimize-viewport-transform.d.ts +54 -0
- package/esm/behaviors/optimize-viewport-transform.js +71 -0
- package/esm/behaviors/optimize-viewport-transform.js.map +1 -0
- package/esm/behaviors/zoom-canvas.js +8 -11
- package/esm/behaviors/zoom-canvas.js.map +1 -1
- package/esm/constants/events/graph.d.ts +13 -1
- package/esm/constants/events/graph.js +12 -0
- package/esm/constants/events/graph.js.map +1 -1
- package/esm/elements/nodes/base-node.js +23 -2
- package/esm/elements/nodes/base-node.js.map +1 -1
- package/esm/elements/nodes/html.js +1 -1
- package/esm/elements/nodes/html.js.map +1 -1
- package/esm/elements/shapes/base-shape.js +0 -1
- package/esm/elements/shapes/base-shape.js.map +1 -1
- package/esm/elements/shapes/label.js +1 -1
- package/esm/elements/shapes/label.js.map +1 -1
- package/esm/exports.d.ts +7 -5
- package/esm/exports.js +4 -3
- package/esm/exports.js.map +1 -1
- package/esm/plugins/history/index.d.ts +3 -4
- package/esm/plugins/history/index.js +6 -7
- package/esm/plugins/history/index.js.map +1 -1
- package/esm/plugins/index.d.ts +2 -0
- package/esm/plugins/index.js +1 -0
- package/esm/plugins/index.js.map +1 -1
- package/esm/plugins/minimap/index.d.ts +131 -0
- package/esm/plugins/minimap/index.js +349 -0
- package/esm/plugins/minimap/index.js.map +1 -0
- package/esm/preset.js +1 -1
- package/esm/preset.js.map +1 -1
- package/esm/registry/build-in.d.ts +4 -4
- package/esm/registry/build-in.js +27 -11
- package/esm/registry/build-in.js.map +1 -1
- package/esm/registry/extension/index.js +1 -1
- package/esm/registry/extension/index.js.map +1 -1
- package/esm/registry/get.d.ts +22 -0
- package/esm/registry/get.js +29 -0
- package/esm/registry/get.js.map +1 -0
- package/esm/registry/{index.d.ts → register.d.ts} +1 -26
- package/esm/registry/{index.js → register.js} +2 -58
- package/esm/registry/register.js.map +1 -0
- package/esm/registry/store.d.ts +7 -0
- package/esm/registry/store.js +18 -0
- package/esm/registry/store.js.map +1 -0
- package/esm/runtime/canvas.d.ts +28 -7
- package/esm/runtime/canvas.js +68 -30
- package/esm/runtime/canvas.js.map +1 -1
- package/esm/runtime/element.d.ts +3 -1
- package/esm/runtime/element.js +9 -3
- package/esm/runtime/element.js.map +1 -1
- package/esm/runtime/graph.d.ts +5 -5
- package/esm/runtime/graph.js +18 -16
- package/esm/runtime/graph.js.map +1 -1
- package/esm/runtime/layout.js +1 -1
- package/esm/runtime/layout.js.map +1 -1
- package/esm/runtime/viewport.js +2 -1
- package/esm/runtime/viewport.js.map +1 -1
- package/esm/themes/base.js +2 -0
- package/esm/themes/base.js.map +1 -1
- package/esm/utils/animation.d.ts +1 -1
- package/esm/utils/animation.js +1 -1
- package/esm/utils/animation.js.map +1 -1
- package/esm/utils/bbox.d.ts +10 -0
- package/esm/utils/bbox.js +15 -0
- package/esm/utils/bbox.js.map +1 -1
- package/esm/utils/event/events.d.ts +4 -4
- package/esm/utils/palette.js +1 -1
- package/esm/utils/palette.js.map +1 -1
- package/esm/utils/print.js +2 -0
- package/esm/utils/print.js.map +1 -1
- package/esm/utils/router/orth.js +4 -4
- package/esm/utils/router/orth.js.map +1 -1
- package/esm/utils/theme.js +1 -1
- package/esm/utils/theme.js.map +1 -1
- package/esm/utils/visibility.d.ts +2 -1
- package/esm/utils/visibility.js +5 -2
- package/esm/utils/visibility.js.map +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/esm/version.js.map +1 -1
- package/lib/behaviors/create-edge.js +6 -4
- package/lib/behaviors/create-edge.js.map +1 -1
- package/lib/behaviors/drag-canvas.d.ts +1 -0
- package/lib/behaviors/drag-canvas.js +18 -12
- package/lib/behaviors/drag-canvas.js.map +1 -1
- package/lib/behaviors/fix-element-size.d.ts +88 -0
- package/lib/behaviors/fix-element-size.js +111 -0
- package/lib/behaviors/fix-element-size.js.map +1 -0
- package/lib/behaviors/hover-activate.js +5 -1
- package/lib/behaviors/hover-activate.js.map +1 -1
- package/lib/behaviors/index.d.ts +4 -0
- package/lib/behaviors/index.js +5 -1
- package/lib/behaviors/index.js.map +1 -1
- package/lib/behaviors/optimize-viewport-transform.d.ts +54 -0
- package/lib/behaviors/optimize-viewport-transform.js +75 -0
- package/lib/behaviors/optimize-viewport-transform.js.map +1 -0
- package/lib/behaviors/zoom-canvas.js +7 -10
- package/lib/behaviors/zoom-canvas.js.map +1 -1
- package/lib/constants/events/graph.d.ts +13 -1
- package/lib/constants/events/graph.js +12 -0
- package/lib/constants/events/graph.js.map +1 -1
- package/lib/elements/nodes/base-node.js +23 -2
- package/lib/elements/nodes/base-node.js.map +1 -1
- package/lib/elements/nodes/html.js +1 -1
- package/lib/elements/nodes/html.js.map +1 -1
- package/lib/elements/shapes/base-shape.js +0 -1
- package/lib/elements/shapes/base-shape.js.map +1 -1
- package/lib/elements/shapes/label.js +1 -1
- package/lib/elements/shapes/label.js.map +1 -1
- package/lib/exports.d.ts +7 -5
- package/lib/exports.js +10 -6
- package/lib/exports.js.map +1 -1
- package/lib/plugins/history/index.d.ts +3 -4
- package/lib/plugins/history/index.js +6 -7
- package/lib/plugins/history/index.js.map +1 -1
- package/lib/plugins/index.d.ts +2 -0
- package/lib/plugins/index.js +3 -1
- package/lib/plugins/index.js.map +1 -1
- package/lib/plugins/minimap/index.d.ts +131 -0
- package/lib/plugins/minimap/index.js +353 -0
- package/lib/plugins/minimap/index.js.map +1 -0
- package/lib/preset.js +2 -2
- package/lib/preset.js.map +1 -1
- package/lib/registry/build-in.d.ts +4 -4
- package/lib/registry/build-in.js +26 -10
- package/lib/registry/build-in.js.map +1 -1
- package/lib/registry/extension/index.js +2 -2
- package/lib/registry/extension/index.js.map +1 -1
- package/lib/registry/get.d.ts +22 -0
- package/lib/registry/get.js +33 -0
- package/lib/registry/get.js.map +1 -0
- package/lib/registry/{index.d.ts → register.d.ts} +1 -26
- package/lib/registry/{index.js → register.js} +4 -63
- package/lib/registry/register.js.map +1 -0
- package/lib/registry/store.d.ts +7 -0
- package/lib/registry/store.js +21 -0
- package/lib/registry/store.js.map +1 -0
- package/lib/runtime/canvas.d.ts +28 -7
- package/lib/runtime/canvas.js +68 -30
- package/lib/runtime/canvas.js.map +1 -1
- package/lib/runtime/element.d.ts +3 -1
- package/lib/runtime/element.js +10 -4
- package/lib/runtime/element.js.map +1 -1
- package/lib/runtime/graph.d.ts +5 -5
- package/lib/runtime/graph.js +18 -16
- package/lib/runtime/graph.js.map +1 -1
- package/lib/runtime/layout.js +3 -3
- package/lib/runtime/layout.js.map +1 -1
- package/lib/runtime/viewport.js +2 -1
- package/lib/runtime/viewport.js.map +1 -1
- package/lib/themes/base.js +2 -0
- package/lib/themes/base.js.map +1 -1
- package/lib/utils/animation.d.ts +1 -1
- package/lib/utils/animation.js +2 -2
- package/lib/utils/animation.js.map +1 -1
- package/lib/utils/bbox.d.ts +10 -0
- package/lib/utils/bbox.js +16 -0
- package/lib/utils/bbox.js.map +1 -1
- package/lib/utils/event/events.d.ts +4 -4
- package/lib/utils/palette.js +3 -3
- package/lib/utils/palette.js.map +1 -1
- package/lib/utils/print.js +2 -0
- package/lib/utils/print.js.map +1 -1
- package/lib/utils/router/orth.js +3 -3
- package/lib/utils/router/orth.js.map +1 -1
- package/lib/utils/theme.js +2 -2
- package/lib/utils/theme.js.map +1 -1
- package/lib/utils/visibility.d.ts +2 -1
- package/lib/utils/visibility.js +5 -2
- package/lib/utils/visibility.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +2 -1
- package/src/behaviors/create-edge.ts +6 -4
- package/src/behaviors/drag-canvas.ts +20 -14
- package/src/behaviors/fix-element-size.ts +190 -0
- package/src/behaviors/hover-activate.ts +8 -1
- package/src/behaviors/index.ts +4 -0
- package/src/behaviors/optimize-viewport-transform.ts +127 -0
- package/src/behaviors/zoom-canvas.ts +8 -10
- package/src/constants/events/graph.ts +12 -0
- package/src/elements/nodes/base-node.ts +27 -2
- package/src/elements/nodes/html.ts +1 -1
- package/src/elements/shapes/base-shape.ts +0 -1
- package/src/elements/shapes/label.ts +1 -1
- package/src/exports.ts +9 -1
- package/src/plugins/history/index.ts +9 -10
- package/src/plugins/index.ts +2 -0
- package/src/plugins/minimap/index.ts +512 -0
- package/src/preset.ts +1 -1
- package/src/registry/build-in.ts +31 -9
- package/src/registry/extension/index.ts +1 -1
- package/src/registry/get.ts +37 -0
- package/src/registry/{index.ts → register.ts} +2 -66
- package/src/registry/store.ts +19 -0
- package/src/runtime/canvas.ts +87 -29
- package/src/runtime/element.ts +20 -4
- package/src/runtime/graph.ts +19 -15
- package/src/runtime/layout.ts +1 -1
- package/src/runtime/viewport.ts +3 -2
- package/src/themes/base.ts +2 -0
- package/src/utils/animation.ts +1 -1
- package/src/utils/bbox.ts +21 -0
- package/src/utils/palette.ts +1 -1
- package/src/utils/print.ts +2 -0
- package/src/utils/router/orth.ts +5 -3
- package/src/utils/theme.ts +1 -1
- package/src/utils/visibility.ts +9 -2
- package/src/version.ts +1 -1
- package/esm/registry/index.js.map +0 -1
- package/lib/registry/index.js.map +0 -1
|
@@ -56,6 +56,7 @@ export declare class DragCanvas extends BaseBehavior<DragCanvasOptions> {
|
|
|
56
56
|
static defaultOptions: Partial<DragCanvasOptions>;
|
|
57
57
|
private shortcut;
|
|
58
58
|
private defaultCursor;
|
|
59
|
+
private get canvas();
|
|
59
60
|
constructor(context: RuntimeContext, options: DragCanvasOptions);
|
|
60
61
|
/**
|
|
61
62
|
* <zh/> 更新配置
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { DisplayObject } from '@antv/g';
|
|
2
|
+
import type { RuntimeContext } from '../runtime/types';
|
|
3
|
+
import type { IViewportEvent, State } from '../types';
|
|
4
|
+
import type { BaseBehaviorOptions } from './base-behavior';
|
|
5
|
+
import { BaseBehavior } from './base-behavior';
|
|
6
|
+
export type FixShapeConfig = {
|
|
7
|
+
/**
|
|
8
|
+
* <zh/> 指定要固定大小的元素属性对应的图形。如果不指定,则固定整个元素
|
|
9
|
+
*
|
|
10
|
+
* <en/> Specify the shape corresponding to properties to be fixed in size. If not specified, fix the entire element
|
|
11
|
+
*/
|
|
12
|
+
shape: (shapes: DisplayObject[]) => DisplayObject;
|
|
13
|
+
/**
|
|
14
|
+
* <zh/> 指定要固定大小的属性
|
|
15
|
+
*
|
|
16
|
+
* <en/> Specify properties to be fixed
|
|
17
|
+
*/
|
|
18
|
+
fields: string[];
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* <zh/> 固定元素大小交互配置项
|
|
22
|
+
*
|
|
23
|
+
* <en/> Fix element size behavior options
|
|
24
|
+
*/
|
|
25
|
+
export interface FixElementSizeOptions extends BaseBehaviorOptions {
|
|
26
|
+
/**
|
|
27
|
+
* <zh/> 是否启用固定元素大小交互。默认在缩小画布时启用
|
|
28
|
+
*
|
|
29
|
+
* <en/> Whether to enable the fix element size behavior. Enabled by default when zooming out
|
|
30
|
+
* @defaultValue `(event) => Boolean(event.data.scale < 1)`
|
|
31
|
+
*/
|
|
32
|
+
enable?: boolean | ((event: IViewportEvent) => boolean);
|
|
33
|
+
/**
|
|
34
|
+
* <zh/> 指定要固定大小的元素状态
|
|
35
|
+
*
|
|
36
|
+
* <en/> Specify the state of elements to be fixed in size
|
|
37
|
+
*/
|
|
38
|
+
state?: State;
|
|
39
|
+
/**
|
|
40
|
+
* <zh/> 节点配置项,用于定义哪些属性在视觉上保持固定大小。若未指定(即为 undefined),则整个节点将被固定
|
|
41
|
+
*
|
|
42
|
+
* <en/> Node configuration for defining which node attributes should remain fixed in size visually. If not specified (i.e., undefined), the entire node will be fixed in size.
|
|
43
|
+
* @example
|
|
44
|
+
* <zh/> 例如,在缩放过程中固定节点的 lineWidth 属性,可以配置如下:
|
|
45
|
+
*
|
|
46
|
+
* <en/> For example, to fix `lineWidth` attribute of a node during zooming, you can configure it as follows:
|
|
47
|
+
* ```ts
|
|
48
|
+
* {
|
|
49
|
+
* node: [
|
|
50
|
+
* {
|
|
51
|
+
* shape: (shapes: DisplayObject[]) => shapes.find((shape) => shape.className === 'key'),
|
|
52
|
+
* fields: ['lineWidth'],
|
|
53
|
+
* },
|
|
54
|
+
* ],
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
node?: FixShapeConfig | FixShapeConfig[];
|
|
59
|
+
/**
|
|
60
|
+
* <zh/> 边配置项,用于定义哪些属性在视觉上保持固定大小。默认固定 lineWidth、labelFontSize 属性
|
|
61
|
+
*
|
|
62
|
+
* <en/> Edge configuration for defining which edge attributes should remain fixed in size visually. By default, the lineWidth and labelFontSize attributes are fixed
|
|
63
|
+
*/
|
|
64
|
+
edge?: FixShapeConfig | FixShapeConfig[];
|
|
65
|
+
/**
|
|
66
|
+
* <zh/> Combo 配置项,用于定义哪些属性在视觉上保持固定大小。默认整个 Combo 将被固定
|
|
67
|
+
*
|
|
68
|
+
* <en/> Combo configuration for defining which combo attributes should remain fixed in size visually. By default, the entire combo will be fixed
|
|
69
|
+
*/
|
|
70
|
+
combo?: FixShapeConfig | FixShapeConfig[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* <zh/> 缩放画布过程中固定元素大小
|
|
74
|
+
*
|
|
75
|
+
* <en/> Fix element size while zooming
|
|
76
|
+
*/
|
|
77
|
+
export declare class FixElementSize extends BaseBehavior {
|
|
78
|
+
static defaultOptions: Partial<FixElementSizeOptions>;
|
|
79
|
+
private elementCache;
|
|
80
|
+
constructor(context: RuntimeContext, options: FixElementSizeOptions);
|
|
81
|
+
private isZoomEvent;
|
|
82
|
+
private fixElementSize;
|
|
83
|
+
private resetTransform;
|
|
84
|
+
private bindEvents;
|
|
85
|
+
private unbindEvents;
|
|
86
|
+
private validate;
|
|
87
|
+
destroy(): void;
|
|
88
|
+
}
|
|
@@ -6,9 +6,11 @@ export { CreateEdge } from './create-edge';
|
|
|
6
6
|
export { DragCanvas } from './drag-canvas';
|
|
7
7
|
export { DragElement } from './drag-element';
|
|
8
8
|
export { DragElementForce } from './drag-element-force';
|
|
9
|
+
export { FixElementSize } from './fix-element-size';
|
|
9
10
|
export { FocusElement } from './focus-element';
|
|
10
11
|
export { HoverActivate } from './hover-activate';
|
|
11
12
|
export { LassoSelect } from './lasso-select';
|
|
13
|
+
export { OptimizeViewportTransform } from './optimize-viewport-transform';
|
|
12
14
|
export { ScrollCanvas } from './scroll-canvas';
|
|
13
15
|
export { ZoomCanvas } from './zoom-canvas';
|
|
14
16
|
export type { BaseBehaviorOptions } from './base-behavior';
|
|
@@ -19,8 +21,10 @@ export type { CreateEdgeOptions } from './create-edge';
|
|
|
19
21
|
export type { DragCanvasOptions } from './drag-canvas';
|
|
20
22
|
export type { DragElementOptions } from './drag-element';
|
|
21
23
|
export type { DragElementForceOptions } from './drag-element-force';
|
|
24
|
+
export type { FixElementSizeOptions } from './fix-element-size';
|
|
22
25
|
export type { FocusElementOptions } from './focus-element';
|
|
23
26
|
export type { HoverActivateOptions } from './hover-activate';
|
|
24
27
|
export type { LassoSelectOptions } from './lasso-select';
|
|
28
|
+
export type { OptimizeViewportTransformOptions } from './optimize-viewport-transform';
|
|
25
29
|
export type { ScrollCanvasOptions } from './scroll-canvas';
|
|
26
30
|
export type { ZoomCanvasOptions } from './zoom-canvas';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { RuntimeContext } from '../runtime/types';
|
|
2
|
+
import type { IViewportEvent } from '../types/event';
|
|
3
|
+
import type { BaseBehaviorOptions } from './base-behavior';
|
|
4
|
+
import { BaseBehavior } from './base-behavior';
|
|
5
|
+
/**
|
|
6
|
+
* <zh/> 画布优化交互配置项
|
|
7
|
+
*
|
|
8
|
+
* <en/> Canvas optimization behavior options
|
|
9
|
+
*/
|
|
10
|
+
export interface OptimizeViewportTransformOptions extends BaseBehaviorOptions {
|
|
11
|
+
/**
|
|
12
|
+
* <zh/> 是否启用画布优化功能
|
|
13
|
+
*
|
|
14
|
+
* <en/> Whether to enable canvas optimization function
|
|
15
|
+
* @defaultValue true
|
|
16
|
+
*/
|
|
17
|
+
enable?: boolean | ((event: IViewportEvent) => boolean);
|
|
18
|
+
/**
|
|
19
|
+
* <zh/> 始终保留的图形类名。操作画布过程中会隐藏元素reservedShapes(除了指定类名的图形),以提高性能
|
|
20
|
+
*
|
|
21
|
+
* <en/> Persistently reserved shape classnames. Elements are hidden during canvas manipulation (except for shapes with specified classnames) to enhance performance.
|
|
22
|
+
* @defaultValue `{ node: ['key'] }`
|
|
23
|
+
*/
|
|
24
|
+
shapes?: {
|
|
25
|
+
node?: string[];
|
|
26
|
+
edge?: string[];
|
|
27
|
+
combo?: string[];
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* <zh/> 设置防抖时间
|
|
31
|
+
*
|
|
32
|
+
* <en/> Set debounce time
|
|
33
|
+
* @defaultValue 200
|
|
34
|
+
*/
|
|
35
|
+
debounce?: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* <zh/> 操作画布过程中隐藏元素
|
|
39
|
+
*
|
|
40
|
+
* <en/> Hide elements during canvas operations (dragging, zooming, scrolling)
|
|
41
|
+
*/
|
|
42
|
+
export declare class OptimizeViewportTransform extends BaseBehavior<OptimizeViewportTransformOptions> {
|
|
43
|
+
static defaultOptions: Partial<OptimizeViewportTransformOptions>;
|
|
44
|
+
private isVisible;
|
|
45
|
+
constructor(context: RuntimeContext, options: OptimizeViewportTransformOptions);
|
|
46
|
+
private filterShapes;
|
|
47
|
+
private setElementsVisibility;
|
|
48
|
+
private hideShapes;
|
|
49
|
+
private showShapes;
|
|
50
|
+
private bindEvents;
|
|
51
|
+
private unbindEvents;
|
|
52
|
+
private validate;
|
|
53
|
+
destroy(): void;
|
|
54
|
+
}
|
|
@@ -166,5 +166,17 @@ export declare enum GraphEvent {
|
|
|
166
166
|
*
|
|
167
167
|
* <en/> After destruction
|
|
168
168
|
*/
|
|
169
|
-
AFTER_DESTROY = "afterdestroy"
|
|
169
|
+
AFTER_DESTROY = "afterdestroy",
|
|
170
|
+
/**
|
|
171
|
+
* <zh/> 渲染器变更之前
|
|
172
|
+
*
|
|
173
|
+
* <en/> Before the renderer changes
|
|
174
|
+
*/
|
|
175
|
+
BEFORE_RENDERER_CHANGE = "beforerendererchange",
|
|
176
|
+
/**
|
|
177
|
+
* <zh/> 渲染器变更之后
|
|
178
|
+
*
|
|
179
|
+
* <en/> After the renderer changes
|
|
180
|
+
*/
|
|
181
|
+
AFTER_RENDERER_CHANGE = "afterrendererchange"
|
|
170
182
|
}
|
package/dist/lib/exports.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export { BaseBehavior, BrushSelect, ClickSelect, CollapseExpand, CreateEdge, DragCanvas, DragElement, DragElementForce, FocusElement, HoverActivate, LassoSelect, ScrollCanvas, ZoomCanvas, } from './behaviors';
|
|
1
|
+
export { BaseBehavior, BrushSelect, ClickSelect, CollapseExpand, CreateEdge, DragCanvas, DragElement, DragElementForce, FixElementSize, FocusElement, HoverActivate, LassoSelect, OptimizeViewportTransform, ScrollCanvas, ZoomCanvas, } from './behaviors';
|
|
2
2
|
export { CanvasEvent, ComboEvent, CommonEvent, ContainerEvent, EdgeEvent, ExtensionCategory, GraphEvent, HistoryEvent, NodeEvent, } from './constants';
|
|
3
3
|
export { BaseCombo, CircleCombo, RectCombo } from './elements/combos';
|
|
4
4
|
export { BaseEdge, Cubic, CubicHorizontal, CubicVertical, Line, Polyline, Quadratic } from './elements/edges';
|
|
5
5
|
export { BaseNode, Circle, Diamond, Donut, Ellipse, HTML, Hexagon, Image, Rect, Star, Triangle, } from './elements/nodes';
|
|
6
6
|
export { Badge, BaseShape, Icon, Label } from './elements/shapes';
|
|
7
7
|
export { AntVDagreLayout, BaseLayout, CircularLayout, ComboCombinedLayout, ConcentricLayout, D3ForceLayout, DagreLayout, ForceAtlas2Layout, ForceLayout, FruchtermanLayout, GridLayout, MDSLayout, RadialLayout, RandomLayout, compactBox, dendrogram, indented, mindmap, } from './layouts';
|
|
8
|
-
export { BasePlugin, BubbleSets, CameraSetting, Contextmenu, Fullscreen, GridLine, History, Hull, Legend, Timebar, Toolbar, Tooltip, Watermark, } from './plugins';
|
|
9
|
-
export { getExtension, getExtensions
|
|
8
|
+
export { BasePlugin, BubbleSets, CameraSetting, Contextmenu, Fullscreen, GridLine, History, Hull, Legend, Minimap, Timebar, Toolbar, Tooltip, Watermark, } from './plugins';
|
|
9
|
+
export { getExtension, getExtensions } from './registry/get';
|
|
10
|
+
export { register } from './registry/register';
|
|
10
11
|
export { Graph } from './runtime/graph';
|
|
11
12
|
export { BaseTransform } from './transforms';
|
|
12
13
|
export { isCollapsed } from './utils/collapsibility';
|
|
@@ -20,7 +21,8 @@ export type { BaseStyleProps } from '@antv/g';
|
|
|
20
21
|
export type { AntVDagreLayoutOptions, CircularLayoutOptions, ComboCombinedLayoutOptions, ConcentricLayoutOptions, D3Force3DLayoutOptions, D3ForceLayoutOptions, DagreLayoutOptions, ForceAtlas2LayoutOptions, ForceLayoutOptions, FruchtermanLayoutOptions, GridLayoutOptions, MDSLayoutOptions, RadialLayoutOptions, RandomLayoutOptions, } from '@antv/layout';
|
|
21
22
|
export type { PathArray } from '@antv/util';
|
|
22
23
|
export type { AnimationContext, AnimationEffectTiming, AnimationExecutor, AnimationOptions } from './animations/types';
|
|
23
|
-
export type { BaseBehaviorOptions, BrushSelectOptions, ClickSelectOptions, CollapseExpandOptions, CreateEdgeOptions, DragCanvasOptions, DragElementForceOptions, DragElementOptions, FocusElementOptions, HoverActivateOptions, LassoSelectOptions, ScrollCanvasOptions, ZoomCanvasOptions, } from './behaviors';
|
|
24
|
+
export type { BaseBehaviorOptions, BrushSelectOptions, ClickSelectOptions, CollapseExpandOptions, CreateEdgeOptions, DragCanvasOptions, DragElementForceOptions, DragElementOptions, FixElementSizeOptions, FocusElementOptions, HoverActivateOptions, LassoSelectOptions, OptimizeViewportTransformOptions, ScrollCanvasOptions, ZoomCanvasOptions, } from './behaviors';
|
|
25
|
+
export type { FixShapeConfig } from './behaviors/fix-element-size';
|
|
24
26
|
export type { BaseComboStyleProps, CircleComboStyleProps, RectComboStyleProps } from './elements/combos';
|
|
25
27
|
export type { BaseEdgeStyleProps, CubicHorizontalStyleProps, CubicStyleProps, CubicVerticalStyleProps, LineStyleProps, PolylineStyleProps, QuadraticStyleProps, } from './elements/edges';
|
|
26
28
|
export type { BaseNodeStyleProps, CircleStyleProps, DiamondStyleProps, DonutStyleProps, EllipseStyleProps, HTMLStyleProps, HexagonStyleProps, ImageStyleProps, RectStyleProps, StarStyleProps, TriangleStyleProps, } from './elements/nodes';
|
|
@@ -28,7 +30,7 @@ export type { BadgeStyleProps, BaseShapeStyleProps, IconStyleProps, LabelStylePr
|
|
|
28
30
|
export type { ContourLabelStyleProps, ContourStyleProps } from './elements/shapes/contour';
|
|
29
31
|
export type { BaseLayoutOptions, WebWorkerLayoutOptions } from './layouts/types';
|
|
30
32
|
export type { CategoricalPalette } from './palettes/types';
|
|
31
|
-
export type { BasePluginOptions, BubbleSetsOptions, CameraSettingOptions, ContextmenuOptions, FullscreenOptions, GridLineOptions, HistoryOptions, HullOptions, LegendOptions, TimebarOptions, ToolbarOptions, TooltipOptions, WatermarkOptions, } from './plugins';
|
|
33
|
+
export type { BasePluginOptions, BubbleSetsOptions, CameraSettingOptions, ContextmenuOptions, FullscreenOptions, GridLineOptions, HistoryOptions, HullOptions, LegendOptions, MinimapOptions, TimebarOptions, ToolbarOptions, TooltipOptions, WatermarkOptions, } from './plugins';
|
|
32
34
|
export type { DataURLOptions } from './runtime/canvas';
|
|
33
35
|
export type { RuntimeContext } from './runtime/types';
|
|
34
36
|
export type { BehaviorOptions, CanvasOptions, ComboData, ComboOptions, EdgeData, EdgeOptions, GraphData, GraphOptions, NodeData, NodeOptions, PluginOptions, ThemeOptions, ViewportOptions, } from './spec';
|
|
@@ -22,13 +22,13 @@ export interface HistoryOptions extends BasePluginOptions {
|
|
|
22
22
|
*
|
|
23
23
|
* <en/> Called before a command is added to the Undo/Redo queue. If this method returns false, the command will not be added to the queue. revert is true for undo operations and false for redo operations
|
|
24
24
|
*/
|
|
25
|
-
beforeAddCommand?: (cmd: Command, revert
|
|
25
|
+
beforeAddCommand?: (cmd: Command, revert: boolean) => boolean | void;
|
|
26
26
|
/**
|
|
27
27
|
* <zh/> 当一个命令被添加到 Undo/Redo 队列后被调用。revert 为 true 时表示撤销操作,为 false 时表示重做操作
|
|
28
28
|
*
|
|
29
29
|
* <en/> Called after a command is added to the Undo/Redo queue. revert is true for undo operations and false for redo operations
|
|
30
30
|
*/
|
|
31
|
-
afterAddCommand?: (cmd: Command, revert
|
|
31
|
+
afterAddCommand?: (cmd: Command, revert: boolean) => void;
|
|
32
32
|
/**
|
|
33
33
|
* <zh/> 执行命令时的回调函数
|
|
34
34
|
*
|
|
@@ -52,7 +52,6 @@ export declare class History extends BasePlugin<HistoryOptions> {
|
|
|
52
52
|
private batchAnimation;
|
|
53
53
|
undoStack: Command[];
|
|
54
54
|
redoStack: Command[];
|
|
55
|
-
private isFirstDraw;
|
|
56
55
|
private freezed;
|
|
57
56
|
constructor(context: RuntimeContext, options: HistoryOptions);
|
|
58
57
|
/**
|
|
@@ -75,7 +74,7 @@ export declare class History extends BasePlugin<HistoryOptions> {
|
|
|
75
74
|
* <en/> Execute undo
|
|
76
75
|
* @returns <zh/> 返回当前实例 | <en/> Return the current instance
|
|
77
76
|
*/
|
|
78
|
-
undo(): this;
|
|
77
|
+
undo(): this | undefined;
|
|
79
78
|
/**
|
|
80
79
|
* <zh/> 执行重做
|
|
81
80
|
*
|
|
@@ -8,6 +8,7 @@ export { GridLine } from './grid-line';
|
|
|
8
8
|
export { History } from './history';
|
|
9
9
|
export { Hull } from './hull';
|
|
10
10
|
export { Legend } from './legend';
|
|
11
|
+
export { Minimap } from './minimap';
|
|
11
12
|
export { Timebar } from './timebar';
|
|
12
13
|
export { Toolbar } from './toolbar';
|
|
13
14
|
export { Tooltip } from './tooltip';
|
|
@@ -22,6 +23,7 @@ export type { GridLineOptions } from './grid-line';
|
|
|
22
23
|
export type { HistoryOptions } from './history';
|
|
23
24
|
export type { HullOptions } from './hull';
|
|
24
25
|
export type { LegendOptions } from './legend';
|
|
26
|
+
export type { MinimapOptions } from './minimap';
|
|
25
27
|
export type { TimebarOptions } from './timebar';
|
|
26
28
|
export type { ToolbarOptions } from './toolbar';
|
|
27
29
|
export type { TooltipOptions } from './tooltip';
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { DisplayObject, IRenderer } from '@antv/g';
|
|
2
|
+
import type { RuntimeContext } from '../../runtime/types';
|
|
3
|
+
import type { ElementType, Padding, Placement } from '../../types';
|
|
4
|
+
import type { BasePluginOptions } from '../base-plugin';
|
|
5
|
+
import { BasePlugin } from '../base-plugin';
|
|
6
|
+
/**
|
|
7
|
+
* <zh/> 缩略图插件的配置项
|
|
8
|
+
*
|
|
9
|
+
* <en/> The configuration item of the Minimap plugin
|
|
10
|
+
*/
|
|
11
|
+
export interface MinimapOptions extends BasePluginOptions {
|
|
12
|
+
/**
|
|
13
|
+
* <zh/> 宽度和高度
|
|
14
|
+
*
|
|
15
|
+
* <en/> Width and height
|
|
16
|
+
*/
|
|
17
|
+
size?: [number, number];
|
|
18
|
+
/**
|
|
19
|
+
* <zh/> 内边距
|
|
20
|
+
*
|
|
21
|
+
* <en/> Padding
|
|
22
|
+
* @defaultValue 10
|
|
23
|
+
*/
|
|
24
|
+
padding?: Padding;
|
|
25
|
+
/**
|
|
26
|
+
* <zh/> 缩略图相对于画布的位置
|
|
27
|
+
*
|
|
28
|
+
* <en/> The position of the minimap relative to the canvas
|
|
29
|
+
* @defaultValue 'right-bottom'
|
|
30
|
+
*/
|
|
31
|
+
position?: Placement;
|
|
32
|
+
/**
|
|
33
|
+
* <zh/> 过滤器,用于过滤不必显示的元素
|
|
34
|
+
*
|
|
35
|
+
* <en/> Filter, used to filter elements that do not need to be displayed
|
|
36
|
+
* @param id - <zh/> 元素的 id | <en/> The id of the element
|
|
37
|
+
* @param elementType - <zh/> 元素的类型 | <en/> The type of the element
|
|
38
|
+
* @returns <zh/> 是否显示 | <en/> Whether to display
|
|
39
|
+
*/
|
|
40
|
+
filter?: (id: string, elementType: ElementType) => boolean;
|
|
41
|
+
/**
|
|
42
|
+
* <zh/> 元素缩略图形的生成方法
|
|
43
|
+
*
|
|
44
|
+
* <en/> The method of generating the thumbnail of the element
|
|
45
|
+
* @defaultValue 'key'
|
|
46
|
+
* @remarks
|
|
47
|
+
* <zh/>
|
|
48
|
+
* - 'key' 使用元素的主图形作为缩略图形
|
|
49
|
+
* - 也可以传入一个函数,接收元素的 id 和类型,返回一个图形
|
|
50
|
+
*
|
|
51
|
+
* <en/>
|
|
52
|
+
* - 'key' uses the key shape of the element as the thumbnail graphic
|
|
53
|
+
* - You can also pass in a function that receives the id and type of the element and returns a shape
|
|
54
|
+
*/
|
|
55
|
+
shape?: 'key' | ((id: string, elementType: ElementType) => DisplayObject);
|
|
56
|
+
/**
|
|
57
|
+
* <zh/> 缩略图画布类名
|
|
58
|
+
*
|
|
59
|
+
* <en/> The class name of the minimap canvas
|
|
60
|
+
*/
|
|
61
|
+
className?: string;
|
|
62
|
+
/**
|
|
63
|
+
* <zh/> 缩略图挂载的容器,无则挂载到 Graph 所在容器
|
|
64
|
+
*
|
|
65
|
+
* <en/> The container where the minimap is mounted, if not, it will be mounted to the container where the Graph is located
|
|
66
|
+
*/
|
|
67
|
+
container?: HTMLElement | string;
|
|
68
|
+
/**
|
|
69
|
+
* <zh/> 缩略图的容器样式,传入外置容器时不生效
|
|
70
|
+
*
|
|
71
|
+
* <en/> The style of the minimap container, which does not take effect when an external container is passed in
|
|
72
|
+
*/
|
|
73
|
+
containerStyle?: Partial<CSSStyleDeclaration>;
|
|
74
|
+
/**
|
|
75
|
+
* <zh/> 遮罩的样式
|
|
76
|
+
*
|
|
77
|
+
* <en/> The style of the mask
|
|
78
|
+
*/
|
|
79
|
+
maskStyle?: Partial<CSSStyleDeclaration>;
|
|
80
|
+
/**
|
|
81
|
+
* <zh/> 渲染器,默认使用 Canvas 渲染器
|
|
82
|
+
*
|
|
83
|
+
* <en/> Renderer, default to use Canvas renderer
|
|
84
|
+
*/
|
|
85
|
+
renderer?: IRenderer;
|
|
86
|
+
}
|
|
87
|
+
export declare class Minimap extends BasePlugin<MinimapOptions> {
|
|
88
|
+
static defaultOptions: Partial<MinimapOptions>;
|
|
89
|
+
private canvas;
|
|
90
|
+
constructor(context: RuntimeContext, options: MinimapOptions);
|
|
91
|
+
private bindEvents;
|
|
92
|
+
private unbindEvents;
|
|
93
|
+
private onDraw;
|
|
94
|
+
private onRender;
|
|
95
|
+
private shapes;
|
|
96
|
+
/**
|
|
97
|
+
* <zh/> 创建或更新缩略图
|
|
98
|
+
*
|
|
99
|
+
* <en/> Create or update the minimap
|
|
100
|
+
*/
|
|
101
|
+
private renderMinimap;
|
|
102
|
+
private getElements;
|
|
103
|
+
private setShapes;
|
|
104
|
+
private container;
|
|
105
|
+
private calculatePosition;
|
|
106
|
+
private createContainer;
|
|
107
|
+
private initCanvas;
|
|
108
|
+
private setCamera;
|
|
109
|
+
private mask;
|
|
110
|
+
private get maskBBox();
|
|
111
|
+
/**
|
|
112
|
+
* <zh/> 计算遮罩包围盒
|
|
113
|
+
*
|
|
114
|
+
* <en/> Calculate the bounding box of the mask
|
|
115
|
+
* @returns <zh/> 遮罩包围盒 | <en/> Mask bounding box
|
|
116
|
+
*/
|
|
117
|
+
private calculateMaskBBox;
|
|
118
|
+
/**
|
|
119
|
+
* <zh/> 创建或更新遮罩
|
|
120
|
+
*
|
|
121
|
+
* <en/> Create or update the mask
|
|
122
|
+
*/
|
|
123
|
+
private renderMask;
|
|
124
|
+
private isMaskDragging;
|
|
125
|
+
private onMaskDragStart;
|
|
126
|
+
private onMaskDrag;
|
|
127
|
+
private onMaskDragEnd;
|
|
128
|
+
private onTransform;
|
|
129
|
+
private updateMask;
|
|
130
|
+
destroy(): void;
|
|
131
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ExtensionRegistry } from './types';
|
|
2
1
|
/**
|
|
3
|
-
* <zh/>
|
|
4
|
-
*
|
|
2
|
+
* <zh/> 注册内置扩展
|
|
3
|
+
*
|
|
4
|
+
* <en/> Register built-in extensions
|
|
5
5
|
*/
|
|
6
|
-
export declare
|
|
6
|
+
export declare function registerBuiltInExtensions(): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ExtensionCategory } from '../constants';
|
|
2
|
+
import type { Loosen } from '../types';
|
|
3
|
+
import type { ExtensionRegistry } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* <zh/> 根据类别和类型获取扩展
|
|
6
|
+
*
|
|
7
|
+
* <en/> Get the extension by category and type
|
|
8
|
+
* @param category - <zh/> 扩展类别 | <en/> Extension category
|
|
9
|
+
* @param type - <zh/> 扩展类型 | <en/> Extension type
|
|
10
|
+
* @returns <zh/> 注册的扩展 | <en/> Registered extension
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function getExtension<T extends ExtensionCategory>(category: Loosen<T>, type: string): ExtensionRegistry[T][string] | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* <zh/> 根据类别获取扩展
|
|
16
|
+
*
|
|
17
|
+
* <en/> Get the extension by category and type
|
|
18
|
+
* @param category - <zh/> 扩展类别 | <en/> Extension category
|
|
19
|
+
* @returns <zh/> 注册的扩展 | <en/> Registered extension
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare function getExtensions<T extends Loosen<ExtensionCategory>>(category: T): ExtensionRegistry[T];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExtensionCategory } from '../constants';
|
|
1
|
+
import type { ExtensionCategory } from '../constants';
|
|
2
2
|
import type { Loosen } from '../types';
|
|
3
3
|
import type { ExtensionRegistry } from './types';
|
|
4
4
|
/**
|
|
@@ -36,28 +36,3 @@ import type { ExtensionRegistry } from './types';
|
|
|
36
36
|
* @public
|
|
37
37
|
*/
|
|
38
38
|
export declare function register<T extends ExtensionCategory>(category: Loosen<T>, type: string, Ctor: ExtensionRegistry[T][string], override?: boolean): void;
|
|
39
|
-
/**
|
|
40
|
-
* <zh/> 根据类别和类型获取扩展
|
|
41
|
-
*
|
|
42
|
-
* <en/> Get the extension by category and type
|
|
43
|
-
* @param category - <zh/> 扩展类别 | <en/> Extension category
|
|
44
|
-
* @param type - <zh/> 扩展类型 | <en/> Extension type
|
|
45
|
-
* @returns <zh/> 注册的扩展 | <en/> Registered extension
|
|
46
|
-
* @internal
|
|
47
|
-
*/
|
|
48
|
-
export declare function getExtension<T extends ExtensionCategory>(category: Loosen<T>, type: string): ExtensionRegistry[T][string] | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* <zh/> 根据类别获取扩展
|
|
51
|
-
*
|
|
52
|
-
* <en/> Get the extension by category and type
|
|
53
|
-
* @param category - <zh/> 扩展类别 | <en/> Extension category
|
|
54
|
-
* @returns <zh/> 注册的扩展 | <en/> Registered extension
|
|
55
|
-
* @internal
|
|
56
|
-
*/
|
|
57
|
-
export declare function getExtensions<T extends Loosen<ExtensionCategory>>(category: T): ExtensionRegistry[T];
|
|
58
|
-
/**
|
|
59
|
-
* <zh/> 注册内置扩展
|
|
60
|
-
*
|
|
61
|
-
* <en/> Register built-in extensions
|
|
62
|
-
*/
|
|
63
|
-
export declare function registerBuiltInExtensions(): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { CanvasConfig as GCanvasConfig, IChildNode } from '@antv/g';
|
|
1
|
+
import type { Cursor, CanvasConfig as GCanvasConfig, IChildNode } from '@antv/g';
|
|
2
2
|
import { Canvas as GCanvas } from '@antv/g';
|
|
3
3
|
import { Renderer as CanvasRenderer } from '@antv/g-canvas';
|
|
4
4
|
import type { CanvasOptions } from '../spec/canvas';
|
|
5
|
-
import type { CanvasLayer } from '../types';
|
|
5
|
+
import type { CanvasLayer, Point } from '../types';
|
|
6
6
|
export interface CanvasConfig extends Pick<GCanvasConfig, 'container' | 'devicePixelRatio' | 'width' | 'height' | 'cursor' | 'background'> {
|
|
7
7
|
renderer?: CanvasOptions['renderer'];
|
|
8
8
|
}
|
|
@@ -31,9 +31,11 @@ export interface DataURLOptions {
|
|
|
31
31
|
*/
|
|
32
32
|
encoderOptions: number;
|
|
33
33
|
}
|
|
34
|
-
export declare class Canvas
|
|
34
|
+
export declare class Canvas {
|
|
35
35
|
private extends;
|
|
36
|
-
|
|
36
|
+
private config;
|
|
37
|
+
getConfig(): CanvasConfig;
|
|
38
|
+
getLayer(layer?: CanvasLayer): GCanvas;
|
|
37
39
|
/**
|
|
38
40
|
* <zh/> 获取所有图层
|
|
39
41
|
*
|
|
@@ -49,14 +51,33 @@ export declare class Canvas extends GCanvas {
|
|
|
49
51
|
* @returns <zh/> 渲染器 <en/> Renderer
|
|
50
52
|
*/
|
|
51
53
|
getRenderer(layer: CanvasLayer): CanvasRenderer;
|
|
54
|
+
/**
|
|
55
|
+
* <zh/> 获取相机
|
|
56
|
+
*
|
|
57
|
+
* <en/> Get camera
|
|
58
|
+
* @param layer - <zh/> 图层 <en/> Layer
|
|
59
|
+
* @returns <zh/> 相机 <en/> Camera
|
|
60
|
+
*/
|
|
61
|
+
getCamera(layer?: CanvasLayer): import("@antv/g").ICamera;
|
|
62
|
+
getRoot(layer?: CanvasLayer): import("@antv/g").Group;
|
|
63
|
+
getContextService(layer?: CanvasLayer): import("@antv/g").ContextService<unknown>;
|
|
64
|
+
setCursor(cursor: Cursor): void;
|
|
65
|
+
get document(): import("@antv/g").Document;
|
|
66
|
+
get context(): import("@antv/g").CanvasContext;
|
|
52
67
|
constructor(config: CanvasConfig);
|
|
53
|
-
get ready(): Promise<
|
|
68
|
+
get ready(): Promise<any[]>;
|
|
54
69
|
resize(width: number, height: number): void;
|
|
55
70
|
getBounds(): import("@antv/g").AABB;
|
|
56
71
|
getContainer(): HTMLElement | null;
|
|
57
72
|
getSize(): [number, number];
|
|
58
73
|
appendChild<T extends IChildNode>(child: T, index?: number): T;
|
|
59
|
-
setRenderer(renderer:
|
|
74
|
+
setRenderer(renderer: CanvasOptions['renderer']): void;
|
|
75
|
+
getCanvasByViewport(point: Point): Point;
|
|
76
|
+
getViewportByCanvas(point: Point): Point;
|
|
77
|
+
getViewportByClient(point: Point): Point;
|
|
78
|
+
getClientByViewport(point: Point): Point;
|
|
79
|
+
getClientByCanvas(point: Point): Point;
|
|
80
|
+
getCanvasByClient(point: Point): Point;
|
|
60
81
|
toDataURL(options?: Partial<DataURLOptions>): Promise<string>;
|
|
61
|
-
destroy(
|
|
82
|
+
destroy(): void;
|
|
62
83
|
}
|
|
@@ -108,11 +108,13 @@ export declare class ElementController {
|
|
|
108
108
|
}
|
|
109
109
|
export interface DrawContext {
|
|
110
110
|
/** <zh/> 是否使用动画,默认为 true | <en/> Whether to use animation, default is true */
|
|
111
|
-
animation
|
|
111
|
+
animation?: boolean;
|
|
112
112
|
/** <zh/> 当前绘制阶段 | <en/> Current draw stage */
|
|
113
113
|
stage?: AnimationStage;
|
|
114
114
|
/** <zh/> 是否不抛出事件 | <en/> Whether not to dispatch events */
|
|
115
115
|
silence?: boolean;
|
|
116
116
|
/** <zh/> 收起/展开的对象 ID | <en/> ID of the object to collapse/expand */
|
|
117
117
|
collapseExpandTarget?: ID;
|
|
118
|
+
/** <zh/> 绘制类型 | <en/> Draw type */
|
|
119
|
+
type?: 'render' | 'draw';
|
|
118
120
|
}
|
|
@@ -945,9 +945,9 @@ export declare class Graph extends EventEmitter {
|
|
|
945
945
|
* <en/> Get the position of the graph
|
|
946
946
|
* @returns <zh/> 图的位置 | <en/> position of the graph
|
|
947
947
|
* @remarks
|
|
948
|
-
* <zh/>
|
|
948
|
+
* <zh/> 即画布原点在视口坐标系下的位置。默认状态下,图的位置为 [0, 0]
|
|
949
949
|
*
|
|
950
|
-
* <en/> By default, the position of the graph is [0, 0]
|
|
950
|
+
* <en/> That is, the position of the canvas origin in the viewport coordinate system. By default, the position of the graph is [0, 0]
|
|
951
951
|
* @apiCategory viewport
|
|
952
952
|
*/
|
|
953
953
|
getPosition(): Point;
|
|
@@ -1202,10 +1202,10 @@ export declare class Graph extends EventEmitter {
|
|
|
1202
1202
|
*/
|
|
1203
1203
|
getViewportCenter(): Point;
|
|
1204
1204
|
/**
|
|
1205
|
-
* <zh/>
|
|
1205
|
+
* <zh/> 获取视口中心的视口坐标
|
|
1206
1206
|
*
|
|
1207
|
-
* <en/> Get the
|
|
1208
|
-
* @returns <zh/>
|
|
1207
|
+
* <en/> Get the viewport coordinates of the viewport center
|
|
1208
|
+
* @returns <zh/> 视口中心的视口坐标 | <en/> Viewport coordinates of the viewport center
|
|
1209
1209
|
* @apiCategory viewport
|
|
1210
1210
|
*/
|
|
1211
1211
|
getCanvasCenter(): Point;
|
|
@@ -24,7 +24,7 @@ export declare function preprocessKeyframes(keyframes: Keyframe[]): Keyframe[];
|
|
|
24
24
|
*
|
|
25
25
|
* <en/> During the animation, some attributes do not explicitly specify the attribute value, but in fact there is an attribute value in G, so use this method to get the actual default value
|
|
26
26
|
*/
|
|
27
|
-
export declare function inferDefaultValue(name: string): false | 0 | 1 | never[] |
|
|
27
|
+
export declare function inferDefaultValue(name: string): false | 0 | 1 | "visible" | never[] | undefined;
|
|
28
28
|
/**
|
|
29
29
|
* <zh/> 获取动画配置
|
|
30
30
|
*
|
package/dist/lib/utils/bbox.d.ts
CHANGED
|
@@ -65,6 +65,16 @@ export declare function getCombinedBBox(bboxes: AABB[]): AABB;
|
|
|
65
65
|
* @returns <zh/> 如果点在包围盒内返回 true,否则返回 false | <en/> Returns true if the point is inside the bounding box, false otherwise
|
|
66
66
|
*/
|
|
67
67
|
export declare function isPointInBBox(point: Point, bbox: AABB): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* <zh/> 判断点是否在给定的包围盒的边界或边界的延长线上
|
|
70
|
+
*
|
|
71
|
+
* <en/> Whether the point is on the boundary or extension line of the given box
|
|
72
|
+
* @param point - <zh/> 点 | <en/> Point
|
|
73
|
+
* @param bbox - <zh/> 包围盒 | <en/> Bounding box
|
|
74
|
+
* @param extended - <zh/> 是否判断边界的延长线 | <en/> Whether to judge the extension line of the boundary
|
|
75
|
+
* @returns <zh/> 如果点在包围盒的边界或边界的延长线上返回 true,否则返回 false | <en/> Returns true if the point is on the boundary or extension line of the bounding box, false otherwise
|
|
76
|
+
*/
|
|
77
|
+
export declare function isPointOnBBoxBoundary(point: Point, bbox: AABB, extended?: boolean): boolean;
|
|
68
78
|
/**
|
|
69
79
|
* <zh/> 判断点是否在给定的包围盒外
|
|
70
80
|
*
|
|
@@ -6,14 +6,14 @@ export declare class BaseEvent {
|
|
|
6
6
|
constructor(type: string);
|
|
7
7
|
}
|
|
8
8
|
export declare class GraphLifeCycleEvent extends BaseEvent implements IGraphLifeCycleEvent {
|
|
9
|
-
data?: any
|
|
10
|
-
constructor(type: GraphEvent.BEFORE_RENDER | GraphEvent.AFTER_RENDER | GraphEvent.BEFORE_DRAW | GraphEvent.AFTER_DRAW | GraphEvent.BEFORE_LAYOUT | GraphEvent.AFTER_LAYOUT | GraphEvent.BEFORE_STAGE_LAYOUT | GraphEvent.AFTER_STAGE_LAYOUT | GraphEvent.BEFORE_SIZE_CHANGE | GraphEvent.AFTER_SIZE_CHANGE | GraphEvent.BATCH_START | GraphEvent.BATCH_END | GraphEvent.BEFORE_DESTROY | GraphEvent.AFTER_DESTROY, data?: any
|
|
9
|
+
data?: any;
|
|
10
|
+
constructor(type: GraphEvent.BEFORE_RENDER | GraphEvent.AFTER_RENDER | GraphEvent.BEFORE_DRAW | GraphEvent.AFTER_DRAW | GraphEvent.BEFORE_LAYOUT | GraphEvent.AFTER_LAYOUT | GraphEvent.BEFORE_STAGE_LAYOUT | GraphEvent.AFTER_STAGE_LAYOUT | GraphEvent.BEFORE_SIZE_CHANGE | GraphEvent.AFTER_SIZE_CHANGE | GraphEvent.BATCH_START | GraphEvent.BATCH_END | GraphEvent.BEFORE_DESTROY | GraphEvent.AFTER_DESTROY, data?: any);
|
|
11
11
|
}
|
|
12
12
|
export declare class AnimateEvent extends BaseEvent implements IAnimateEvent {
|
|
13
13
|
animationType: AnimationType;
|
|
14
14
|
animation: IAnimation | null;
|
|
15
|
-
data?: any
|
|
16
|
-
constructor(type: GraphEvent.BEFORE_ANIMATE | GraphEvent.AFTER_ANIMATE, animationType: AnimationType, animation: IAnimation | null, data?: any
|
|
15
|
+
data?: any;
|
|
16
|
+
constructor(type: GraphEvent.BEFORE_ANIMATE | GraphEvent.AFTER_ANIMATE, animationType: AnimationType, animation: IAnimation | null, data?: any);
|
|
17
17
|
}
|
|
18
18
|
export declare class ElementLifeCycleEvent extends BaseEvent implements IElementLifeCycleEvent {
|
|
19
19
|
elementType: ElementType;
|