@antv/g6 5.0.15 → 5.0.17
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 +13 -0
- package/dist/lib/behaviors/optimize-viewport-transform.d.ts +0 -1
- package/dist/lib/behaviors/scroll-canvas.d.ts +7 -0
- package/dist/lib/behaviors/zoom-canvas.d.ts +7 -0
- package/dist/lib/constants/registry.d.ts +7 -1
- package/dist/lib/elements/edges/base-edge.d.ts +2 -2
- package/dist/lib/elements/edges/polyline.d.ts +4 -20
- package/dist/lib/elements/shapes/base-shape.d.ts +51 -2
- package/dist/lib/exports.d.ts +3 -2
- package/dist/lib/plugins/edge-filter-lens/index.d.ts +125 -0
- package/dist/lib/plugins/index.d.ts +4 -0
- package/dist/lib/plugins/snapline/index.d.ts +95 -0
- package/dist/lib/registry/types.d.ts +4 -0
- package/dist/lib/runtime/element.d.ts +1 -0
- package/dist/lib/runtime/plugin.d.ts +1 -1
- package/dist/lib/runtime/viewport.d.ts +8 -0
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/lib/types/router.d.ts +103 -0
- package/dist/lib/utils/bbox.d.ts +8 -0
- package/dist/lib/utils/router/orth.d.ts +8 -8
- package/dist/lib/utils/router/shortest-path.d.ts +57 -0
- package/dist/lib/utils/text.d.ts +1 -1
- package/dist/lib/utils/visibility.d.ts +2 -1
- package/dist/lib/version.d.ts +1 -1
- package/esm/behaviors/brush-select.js +11 -6
- package/esm/behaviors/brush-select.js.map +1 -1
- package/esm/behaviors/drag-canvas.d.ts +13 -0
- package/esm/behaviors/drag-canvas.js +10 -1
- package/esm/behaviors/drag-canvas.js.map +1 -1
- package/esm/behaviors/optimize-viewport-transform.d.ts +0 -1
- package/esm/behaviors/optimize-viewport-transform.js +5 -4
- package/esm/behaviors/optimize-viewport-transform.js.map +1 -1
- package/esm/behaviors/scroll-canvas.d.ts +7 -0
- package/esm/behaviors/scroll-canvas.js +3 -1
- package/esm/behaviors/scroll-canvas.js.map +1 -1
- package/esm/behaviors/zoom-canvas.d.ts +7 -0
- package/esm/behaviors/zoom-canvas.js +3 -1
- package/esm/behaviors/zoom-canvas.js.map +1 -1
- package/esm/constants/registry.d.ts +7 -1
- package/esm/constants/registry.js +6 -0
- package/esm/constants/registry.js.map +1 -1
- package/esm/elements/edges/base-edge.d.ts +2 -2
- package/esm/elements/edges/base-edge.js +10 -4
- package/esm/elements/edges/base-edge.js.map +1 -1
- package/esm/elements/edges/polyline.d.ts +4 -20
- package/esm/elements/edges/polyline.js +32 -33
- package/esm/elements/edges/polyline.js.map +1 -1
- package/esm/elements/shapes/base-shape.d.ts +51 -2
- package/esm/elements/shapes/base-shape.js +23 -5
- 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/plugins/edge-filter-lens/index.d.ts +125 -0
- package/esm/plugins/edge-filter-lens/index.js +236 -0
- package/esm/plugins/edge-filter-lens/index.js.map +1 -0
- package/esm/plugins/index.d.ts +4 -0
- package/esm/plugins/index.js +2 -0
- package/esm/plugins/index.js.map +1 -1
- package/esm/plugins/snapline/index.d.ts +95 -0
- package/esm/plugins/snapline/index.js +268 -0
- package/esm/plugins/snapline/index.js.map +1 -0
- package/esm/registry/build-in.js +21 -2
- package/esm/registry/build-in.js.map +1 -1
- package/esm/registry/store.js +1 -0
- package/esm/registry/store.js.map +1 -1
- package/esm/registry/types.d.ts +4 -0
- package/esm/runtime/element.d.ts +1 -0
- package/esm/runtime/element.js +10 -4
- package/esm/runtime/element.js.map +1 -1
- package/esm/runtime/plugin.d.ts +1 -1
- package/esm/runtime/plugin.js +8 -1
- package/esm/runtime/plugin.js.map +1 -1
- package/esm/runtime/viewport.d.ts +8 -0
- package/esm/runtime/viewport.js +35 -2
- package/esm/runtime/viewport.js.map +1 -1
- package/esm/types/index.d.ts +1 -0
- package/esm/types/router.d.ts +103 -0
- package/esm/types/router.js +2 -0
- package/esm/types/router.js.map +1 -0
- package/esm/utils/bbox.d.ts +8 -0
- package/esm/utils/bbox.js +19 -0
- package/esm/utils/bbox.js.map +1 -1
- package/esm/utils/router/orth.d.ts +8 -8
- package/esm/utils/router/orth.js +13 -7
- package/esm/utils/router/orth.js.map +1 -1
- package/esm/utils/router/shortest-path.d.ts +57 -0
- package/esm/utils/router/shortest-path.js +387 -0
- package/esm/utils/router/shortest-path.js.map +1 -0
- package/esm/utils/text.d.ts +1 -1
- package/esm/utils/visibility.d.ts +2 -1
- package/esm/utils/visibility.js +3 -2
- package/esm/utils/visibility.js.map +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/lib/behaviors/brush-select.js +11 -6
- package/lib/behaviors/brush-select.js.map +1 -1
- package/lib/behaviors/drag-canvas.d.ts +13 -0
- package/lib/behaviors/drag-canvas.js +10 -1
- package/lib/behaviors/drag-canvas.js.map +1 -1
- package/lib/behaviors/optimize-viewport-transform.d.ts +0 -1
- package/lib/behaviors/optimize-viewport-transform.js +5 -4
- package/lib/behaviors/optimize-viewport-transform.js.map +1 -1
- package/lib/behaviors/scroll-canvas.d.ts +7 -0
- package/lib/behaviors/scroll-canvas.js +3 -1
- package/lib/behaviors/scroll-canvas.js.map +1 -1
- package/lib/behaviors/zoom-canvas.d.ts +7 -0
- package/lib/behaviors/zoom-canvas.js +3 -1
- package/lib/behaviors/zoom-canvas.js.map +1 -1
- package/lib/constants/registry.d.ts +7 -1
- package/lib/constants/registry.js +6 -0
- package/lib/constants/registry.js.map +1 -1
- package/lib/elements/edges/base-edge.d.ts +2 -2
- package/lib/elements/edges/base-edge.js +9 -3
- package/lib/elements/edges/base-edge.js.map +1 -1
- package/lib/elements/edges/polyline.d.ts +4 -20
- package/lib/elements/edges/polyline.js +32 -33
- package/lib/elements/edges/polyline.js.map +1 -1
- package/lib/elements/shapes/base-shape.d.ts +51 -2
- package/lib/elements/shapes/base-shape.js +23 -5
- package/lib/elements/shapes/base-shape.js.map +1 -1
- package/lib/exports.d.ts +3 -2
- package/lib/exports.js +3 -1
- package/lib/exports.js.map +1 -1
- package/lib/plugins/edge-filter-lens/index.d.ts +125 -0
- package/lib/plugins/edge-filter-lens/index.js +240 -0
- package/lib/plugins/edge-filter-lens/index.js.map +1 -0
- package/lib/plugins/index.d.ts +4 -0
- package/lib/plugins/index.js +5 -1
- package/lib/plugins/index.js.map +1 -1
- package/lib/plugins/snapline/index.d.ts +95 -0
- package/lib/plugins/snapline/index.js +272 -0
- package/lib/plugins/snapline/index.js.map +1 -0
- package/lib/registry/build-in.js +20 -1
- package/lib/registry/build-in.js.map +1 -1
- package/lib/registry/store.js +1 -0
- package/lib/registry/store.js.map +1 -1
- package/lib/registry/types.d.ts +4 -0
- package/lib/runtime/element.d.ts +1 -0
- package/lib/runtime/element.js +9 -3
- package/lib/runtime/element.js.map +1 -1
- package/lib/runtime/plugin.d.ts +1 -1
- package/lib/runtime/plugin.js +8 -1
- package/lib/runtime/plugin.js.map +1 -1
- package/lib/runtime/viewport.d.ts +8 -0
- package/lib/runtime/viewport.js +34 -1
- package/lib/runtime/viewport.js.map +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/router.d.ts +103 -0
- package/lib/types/router.js +3 -0
- package/lib/types/router.js.map +1 -0
- package/lib/utils/bbox.d.ts +8 -0
- package/lib/utils/bbox.js +20 -0
- package/lib/utils/bbox.js.map +1 -1
- package/lib/utils/router/orth.d.ts +8 -8
- package/lib/utils/router/orth.js +13 -7
- package/lib/utils/router/orth.js.map +1 -1
- package/lib/utils/router/shortest-path.d.ts +57 -0
- package/lib/utils/router/shortest-path.js +394 -0
- package/lib/utils/router/shortest-path.js.map +1 -0
- package/lib/utils/text.d.ts +1 -1
- package/lib/utils/visibility.d.ts +2 -1
- package/lib/utils/visibility.js +3 -2
- package/lib/utils/visibility.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/behaviors/brush-select.ts +12 -5
- package/src/behaviors/drag-canvas.ts +24 -1
- package/src/behaviors/optimize-viewport-transform.ts +4 -9
- package/src/behaviors/scroll-canvas.ts +9 -1
- package/src/behaviors/zoom-canvas.ts +9 -1
- package/src/constants/registry.ts +6 -0
- package/src/elements/edges/base-edge.ts +19 -5
- package/src/elements/edges/polyline.ts +36 -65
- package/src/elements/shapes/base-shape.ts +76 -6
- package/src/exports.ts +5 -0
- package/src/plugins/edge-filter-lens/index.ts +391 -0
- package/src/plugins/grid-line.ts +1 -1
- package/src/plugins/index.ts +4 -0
- package/src/plugins/snapline/index.ts +383 -0
- package/src/registry/build-in.ts +33 -1
- package/src/registry/store.ts +1 -0
- package/src/registry/types.ts +2 -0
- package/src/runtime/element.ts +11 -4
- package/src/runtime/plugin.ts +8 -1
- package/src/runtime/viewport.ts +42 -3
- package/src/types/index.ts +1 -0
- package/src/types/router.ts +107 -0
- package/src/utils/bbox.ts +24 -0
- package/src/utils/router/orth.ts +19 -10
- package/src/utils/router/shortest-path.ts +470 -0
- package/src/utils/text.ts +1 -1
- package/src/utils/visibility.ts +3 -1
- package/src/version.ts +1 -1
|
@@ -22,6 +22,19 @@ export interface DragCanvasOptions extends BaseBehaviorOptions {
|
|
|
22
22
|
* @defaultValue true
|
|
23
23
|
*/
|
|
24
24
|
enable?: boolean | ((event: IPointerEvent | IKeyboardEvent) => boolean);
|
|
25
|
+
/**
|
|
26
|
+
* <zh/> 允许拖拽方向
|
|
27
|
+
* - `'x'`: 只允许水平拖拽
|
|
28
|
+
* - `'y'`: 只允许垂直拖拽
|
|
29
|
+
* - `'both'`: 不受限制,允许水平和垂直拖拽
|
|
30
|
+
*
|
|
31
|
+
* <en/> Allowed drag direction
|
|
32
|
+
* - `'x'`: Only allow horizontal drag
|
|
33
|
+
* - `'y'`: Only allow vertical drag
|
|
34
|
+
* - `'both'`: Allow horizontal and vertical drag
|
|
35
|
+
* @defaultValue `'both'`
|
|
36
|
+
*/
|
|
37
|
+
direction?: 'x' | 'y' | 'both';
|
|
25
38
|
/**
|
|
26
39
|
* <zh/> 触发拖拽的方式,默认使用指针按下拖拽
|
|
27
40
|
*
|
|
@@ -43,7 +43,6 @@ export declare class OptimizeViewportTransform extends BaseBehavior<OptimizeView
|
|
|
43
43
|
static defaultOptions: Partial<OptimizeViewportTransformOptions>;
|
|
44
44
|
private isVisible;
|
|
45
45
|
constructor(context: RuntimeContext, options: OptimizeViewportTransformOptions);
|
|
46
|
-
private filterShapes;
|
|
47
46
|
private setElementsVisibility;
|
|
48
47
|
private hideShapes;
|
|
49
48
|
private showShapes;
|
|
@@ -52,6 +52,13 @@ export interface ScrollCanvasOptions extends BaseBehaviorOptions {
|
|
|
52
52
|
* <en/> Callback when scrolling is completed
|
|
53
53
|
*/
|
|
54
54
|
onFinish?: () => void;
|
|
55
|
+
/**
|
|
56
|
+
* <zh/> 是否阻止默认事件
|
|
57
|
+
*
|
|
58
|
+
* <en/> Whether to prevent the default event
|
|
59
|
+
* @defaultValue true
|
|
60
|
+
*/
|
|
61
|
+
preventDefault?: boolean;
|
|
55
62
|
}
|
|
56
63
|
/**
|
|
57
64
|
* <zh/> 滚动画布交互
|
|
@@ -50,6 +50,13 @@ export interface ZoomCanvasOptions extends BaseBehaviorOptions {
|
|
|
50
50
|
* <en/> Callback when zooming is completed
|
|
51
51
|
*/
|
|
52
52
|
onFinish?: () => void;
|
|
53
|
+
/**
|
|
54
|
+
* <zh/> 是否阻止默认事件
|
|
55
|
+
*
|
|
56
|
+
* <en/> Whether to prevent the default event
|
|
57
|
+
* @defaultValue true
|
|
58
|
+
*/
|
|
59
|
+
preventDefault?: boolean;
|
|
53
60
|
}
|
|
54
61
|
/**
|
|
55
62
|
* <zh/> 缩放画布交互
|
|
@@ -121,7 +121,7 @@ export interface BaseEdgeStyleProps extends BaseElementStyleProps, Prefix<'label
|
|
|
121
121
|
/**
|
|
122
122
|
* <zh/> 在路径除了 “起点” 和 “终点” 之外的每一个顶点上放置标记图形。在内部实现中,由于我们会把路径中部分命令转换成 C 命令,因此这些顶点实际是三阶贝塞尔曲线的控制点
|
|
123
123
|
*
|
|
124
|
-
* <en/> Place a marker graphic on each vertex of the path except for the "start point" and "end point". In the internal implementation, because we will convert some commands in the path to C commands, these
|
|
124
|
+
* <en/> Place a marker graphic on each vertex of the path except for the "start point" and "end point". In the internal implementation, because we will convert some commands in the path to C commands, these controlPoints are actually the control points of the cubic Bezier curve
|
|
125
125
|
*/
|
|
126
126
|
markerMid?: DisplayObject | null;
|
|
127
127
|
/**
|
|
@@ -147,7 +147,7 @@ export declare abstract class BaseEdge extends BaseElement<BaseEdgeStyleProps> i
|
|
|
147
147
|
protected getKeyStyle(attributes: ParsedBaseEdgeStyleProps): PathStyleProps;
|
|
148
148
|
protected abstract getKeyPath(attributes: ParsedBaseEdgeStyleProps): PathArray;
|
|
149
149
|
protected getLoopPath(attributes: ParsedBaseEdgeStyleProps): PathArray;
|
|
150
|
-
protected getEndpoints(attributes: ParsedBaseEdgeStyleProps): [Point, Point];
|
|
150
|
+
protected getEndpoints(attributes: ParsedBaseEdgeStyleProps, optimize?: boolean, controlPoints?: Point[] | (() => Point[])): [Point, Point];
|
|
151
151
|
protected getHaloStyle(attributes: ParsedBaseEdgeStyleProps): false | PathStyleProps;
|
|
152
152
|
protected getLabelStyle(attributes: ParsedBaseEdgeStyleProps): false | LabelStyleProps;
|
|
153
153
|
protected getBadgeStyle(attributes: ParsedBaseEdgeStyleProps): false | BadgeStyleProps;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DisplayObjectConfig } from '@antv/g';
|
|
2
2
|
import type { PathArray } from '@antv/util';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Point, PolylineRouter } from '../../types';
|
|
4
4
|
import type { BaseEdgeStyleProps } from './base-edge';
|
|
5
5
|
import { BaseEdge } from './base-edge';
|
|
6
6
|
/**
|
|
@@ -28,23 +28,7 @@ export interface PolylineStyleProps extends BaseEdgeStyleProps {
|
|
|
28
28
|
* <en/> Whether to enable routing, it is enabled by default and controlPoints will be automatically included
|
|
29
29
|
* @defaultValue false
|
|
30
30
|
*/
|
|
31
|
-
router?:
|
|
32
|
-
/**
|
|
33
|
-
* <zh/> 路由名称,目前支持 'orth'
|
|
34
|
-
*
|
|
35
|
-
* <en/> Routing name, currently supports 'orth'
|
|
36
|
-
* @defaultValue 'orth'
|
|
37
|
-
* @remarks
|
|
38
|
-
* <img width="300" src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*8Ia2RJFFQSoAAAAAAAAAAAAADmJ7AQ/original" />
|
|
39
|
-
*/
|
|
40
|
-
routerName?: 'orth';
|
|
41
|
-
/**
|
|
42
|
-
* <zh/> 节点边距
|
|
43
|
-
*
|
|
44
|
-
* <en/> Padding for routing calculation
|
|
45
|
-
* @defaultValue 10
|
|
46
|
-
*/
|
|
47
|
-
routerPadding?: Padding;
|
|
31
|
+
router?: PolylineRouter;
|
|
48
32
|
}
|
|
49
33
|
type ParsedPolylineStyleProps = Required<PolylineStyleProps>;
|
|
50
34
|
/**
|
|
@@ -55,9 +39,9 @@ type ParsedPolylineStyleProps = Required<PolylineStyleProps>;
|
|
|
55
39
|
export declare class Polyline extends BaseEdge {
|
|
56
40
|
static defaultStyleProps: Partial<PolylineStyleProps>;
|
|
57
41
|
constructor(options: DisplayObjectConfig<PolylineStyleProps>);
|
|
42
|
+
protected getControlPoints(attributes: ParsedPolylineStyleProps): Point[];
|
|
43
|
+
protected getPoints(attributes: ParsedPolylineStyleProps): Point[];
|
|
58
44
|
protected getKeyPath(attributes: ParsedPolylineStyleProps): PathArray;
|
|
59
|
-
private getEndpointsAndPorts;
|
|
60
|
-
protected getControlPoints(attributes: ParsedPolylineStyleProps, sourcePoint: Point, targetPoint: Point): Point[];
|
|
61
45
|
protected getLoopPath(attributes: ParsedPolylineStyleProps): PathArray;
|
|
62
46
|
}
|
|
63
47
|
export {};
|
|
@@ -26,11 +26,12 @@ export declare abstract class BaseShape<StyleProps extends BaseShapeStyleProps>
|
|
|
26
26
|
* @param Ctor - <zh> 图形类型 | <en> shape type
|
|
27
27
|
* @param style - <zh> 图形样式 | <en> shape style
|
|
28
28
|
* @param container - <zh> 容器 | <en> container
|
|
29
|
+
* @param hooks - <zh> 钩子函数 | <en> hooks
|
|
29
30
|
* @returns <zh> 图形实例 | <en> shape instance
|
|
30
31
|
*/
|
|
31
|
-
protected upsert<T extends DisplayObject>(className: string, Ctor: {
|
|
32
|
+
protected upsert<T extends DisplayObject>(className: string, Ctor: string | {
|
|
32
33
|
new (...args: any[]): T;
|
|
33
|
-
}, style: T['attributes'] | false, container: DisplayObject): T | undefined;
|
|
34
|
+
}, style: T['attributes'] | false, container: DisplayObject, hooks?: UpsertHooks): T | undefined;
|
|
34
35
|
/**
|
|
35
36
|
* <zh/> 使用 transform 更新图形位置
|
|
36
37
|
*
|
|
@@ -67,3 +68,51 @@ export declare abstract class BaseShape<StyleProps extends BaseShapeStyleProps>
|
|
|
67
68
|
private setVisibility;
|
|
68
69
|
destroy(): void;
|
|
69
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* <zh/> 图形 upsert 方法生命周期钩子
|
|
73
|
+
*
|
|
74
|
+
* <en/> Shape upsert method lifecycle hooks
|
|
75
|
+
*/
|
|
76
|
+
export interface UpsertHooks {
|
|
77
|
+
/**
|
|
78
|
+
* <zh/> 图形创建前
|
|
79
|
+
*
|
|
80
|
+
* <en/> Before creating the shape
|
|
81
|
+
*/
|
|
82
|
+
beforeCreate?: () => void;
|
|
83
|
+
/**
|
|
84
|
+
* <zh/> 图形创建后
|
|
85
|
+
*
|
|
86
|
+
* <en/> After creating the shape
|
|
87
|
+
* @param instance - <zh/> 图形实例 | <en/> shape instance
|
|
88
|
+
*/
|
|
89
|
+
afterCreate?: (instance: DisplayObject) => void;
|
|
90
|
+
/**
|
|
91
|
+
* <zh/> 图形更新前
|
|
92
|
+
*
|
|
93
|
+
* <en/> Before updating the shape
|
|
94
|
+
* @param instance - <zh/> 图形实例 | <en/> shape instance
|
|
95
|
+
*/
|
|
96
|
+
beforeUpdate?: (instance: DisplayObject) => void;
|
|
97
|
+
/**
|
|
98
|
+
* <zh/> 图形更新后
|
|
99
|
+
*
|
|
100
|
+
* <en/> After updating the shape
|
|
101
|
+
* @param instance - <zh/> 图形实例 | <en/> shape instance
|
|
102
|
+
*/
|
|
103
|
+
afterUpdate?: (instance: DisplayObject) => void;
|
|
104
|
+
/**
|
|
105
|
+
* <zh/> 图形销毁前
|
|
106
|
+
*
|
|
107
|
+
* <en/> Before destroying the shape
|
|
108
|
+
* @param instance - <zh/> 图形实例 | <en/> shape instance
|
|
109
|
+
*/
|
|
110
|
+
beforeDestroy?: (instance: DisplayObject) => void;
|
|
111
|
+
/**
|
|
112
|
+
* <zh/> 图形销毁后
|
|
113
|
+
*
|
|
114
|
+
* <en/> After destroying the shape
|
|
115
|
+
* @param instance - <zh/> 图形实例 | <en/> shape instance
|
|
116
|
+
*/
|
|
117
|
+
afterDestroy?: (instance: DisplayObject) => void;
|
|
118
|
+
}
|
package/dist/lib/exports.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { BaseEdge, Cubic, CubicHorizontal, CubicVertical, Line, Polyline, Quadra
|
|
|
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, Minimap, Timebar, Toolbar, Tooltip, Watermark, } from './plugins';
|
|
8
|
+
export { BasePlugin, BubbleSets, CameraSetting, Contextmenu, EdgeFilterLens, Fullscreen, GridLine, History, Hull, Legend, Minimap, Snapline, Timebar, Toolbar, Tooltip, Watermark, } from './plugins';
|
|
9
9
|
export { getExtension, getExtensions } from './registry/get';
|
|
10
10
|
export { register } from './registry/register';
|
|
11
11
|
export { Graph } from './runtime/graph';
|
|
@@ -28,10 +28,11 @@ export type { BaseComboStyleProps, CircleComboStyleProps, RectComboStyleProps }
|
|
|
28
28
|
export type { BaseEdgeStyleProps, CubicHorizontalStyleProps, CubicStyleProps, CubicVerticalStyleProps, LineStyleProps, PolylineStyleProps, QuadraticStyleProps, } from './elements/edges';
|
|
29
29
|
export type { BaseNodeStyleProps, CircleStyleProps, DiamondStyleProps, DonutStyleProps, EllipseStyleProps, HTMLStyleProps, HexagonStyleProps, ImageStyleProps, RectStyleProps, StarStyleProps, TriangleStyleProps, } from './elements/nodes';
|
|
30
30
|
export type { BadgeStyleProps, BaseShapeStyleProps, IconStyleProps, LabelStyleProps, PolygonStyleProps, } from './elements/shapes';
|
|
31
|
+
export type { UpsertHooks } from './elements/shapes/base-shape';
|
|
31
32
|
export type { ContourLabelStyleProps, ContourStyleProps } from './elements/shapes/contour';
|
|
32
33
|
export type { BaseLayoutOptions, WebWorkerLayoutOptions } from './layouts/types';
|
|
33
34
|
export type { CategoricalPalette } from './palettes/types';
|
|
34
|
-
export type { BasePluginOptions, BubbleSetsOptions, CameraSettingOptions, ContextmenuOptions, FullscreenOptions, GridLineOptions, HistoryOptions, HullOptions, LegendOptions, MinimapOptions, TimebarOptions, ToolbarOptions, TooltipOptions, WatermarkOptions, } from './plugins';
|
|
35
|
+
export type { BasePluginOptions, BubbleSetsOptions, CameraSettingOptions, ContextmenuOptions, EdgeFilterLensOptions, FullscreenOptions, GridLineOptions, HistoryOptions, HullOptions, LegendOptions, MinimapOptions, SnaplineOptions, TimebarOptions, ToolbarOptions, TooltipOptions, WatermarkOptions, } from './plugins';
|
|
35
36
|
export type { DataURLOptions } from './runtime/canvas';
|
|
36
37
|
export type { RuntimeContext } from './runtime/types';
|
|
37
38
|
export type { BehaviorOptions, CanvasOptions, ComboData, ComboOptions, EdgeData, EdgeOptions, GraphData, GraphOptions, NodeData, NodeOptions, PluginOptions, ThemeOptions, ViewportOptions, } from './spec';
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { BaseStyleProps } from '@antv/g';
|
|
2
|
+
import type { RuntimeContext } from '../../runtime/types';
|
|
3
|
+
import type { EdgeData, NodeData } from '../../spec';
|
|
4
|
+
import type { EdgeStyle } from '../../spec/element/edge';
|
|
5
|
+
import type { NodeStyle } from '../../spec/element/node';
|
|
6
|
+
import type { ElementType, ID, IPointerEvent } from '../../types';
|
|
7
|
+
import type { BasePluginOptions } from '../base-plugin';
|
|
8
|
+
import { BasePlugin } from '../base-plugin';
|
|
9
|
+
export interface EdgeFilterLensOptions extends BasePluginOptions {
|
|
10
|
+
/**
|
|
11
|
+
* <zh/> 移动透镜的方式
|
|
12
|
+
* - `'pointermove'`:始终跟随鼠标移动
|
|
13
|
+
* - `'click'`:鼠标点击时透镜移动
|
|
14
|
+
* - `'drag'`:拖拽透镜
|
|
15
|
+
*
|
|
16
|
+
* <en/> The way to move the lens
|
|
17
|
+
* - `'pointermove'`: always follow the mouse movement
|
|
18
|
+
* - `'click'`: move the lens when the mouse clicks
|
|
19
|
+
* - `'drag'`: drag the lens
|
|
20
|
+
* @defaultValue 'pointermove'
|
|
21
|
+
*/
|
|
22
|
+
trigger?: 'pointermove' | 'click' | 'drag';
|
|
23
|
+
/**
|
|
24
|
+
* <zh/> 透镜的半径
|
|
25
|
+
*
|
|
26
|
+
* <en/> The radius of the lens
|
|
27
|
+
* @defaultValue 60
|
|
28
|
+
*/
|
|
29
|
+
r?: number;
|
|
30
|
+
/**
|
|
31
|
+
* <zh/> 透镜的最大半径。只有在开启 `scaleRByWheel` 时生效
|
|
32
|
+
*
|
|
33
|
+
* <en/> The maximum radius of the lens. Only valid when `scaleRByWheel` is enabled
|
|
34
|
+
* @defaultValue canvas 宽高最小值的一半
|
|
35
|
+
*/
|
|
36
|
+
maxR?: number;
|
|
37
|
+
/**
|
|
38
|
+
* <zh/> 透镜的最小半径。只有在开启 `scaleRByWheel` 时生效
|
|
39
|
+
*
|
|
40
|
+
* <en/> The minimum radius of the lens. Only valid when `scaleRByWheel` is enabled
|
|
41
|
+
* @defaultValue 0
|
|
42
|
+
*/
|
|
43
|
+
minR?: number;
|
|
44
|
+
/**
|
|
45
|
+
* <zh/> 是否通过滚轮缩放透镜的半径
|
|
46
|
+
*
|
|
47
|
+
* <en/> Whether to scale the radius of the lens by wheel
|
|
48
|
+
* @defaultValue true
|
|
49
|
+
*/
|
|
50
|
+
scaleRByWheel?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* <zh/> 边显示的条件
|
|
53
|
+
* - `'both'`:只有起始节点和目标节点都在透镜中时,边才会显示
|
|
54
|
+
* - `'source'`:只有起始节点在透镜中时,边才会显示
|
|
55
|
+
* - `'target'`:只有目标节点在透镜中时,边才会显示
|
|
56
|
+
* - `'either'`:只要起始节点或目标节点有一个在透镜中时,边就会显示
|
|
57
|
+
*
|
|
58
|
+
* <zh/> The condition for displaying the edge
|
|
59
|
+
* - `'both'`: The edge is displayed only when both the source node and the target node are in the lens
|
|
60
|
+
* - `'source'`: The edge is displayed only when the source node is in the lens
|
|
61
|
+
* - `'target'`: The edge is displayed only when the target node is in the lens
|
|
62
|
+
* - `'either'`: The edge is displayed when either the source node or the target node is in the lens
|
|
63
|
+
* @defaultValue 'both'
|
|
64
|
+
*/
|
|
65
|
+
nodeType?: 'both' | 'source' | 'target' | 'either';
|
|
66
|
+
/**
|
|
67
|
+
* <zh/> 过滤出始终不在透镜中显示的元素
|
|
68
|
+
*
|
|
69
|
+
* <en/> Filter elements that are never displayed in the lens
|
|
70
|
+
* @param id - <zh/> 元素的 id | <en/> The id of the element
|
|
71
|
+
* @param elementType - <zh/> 元素的类型 | <en/> The type of the element
|
|
72
|
+
* @returns <zh/> 是否显示 | <en/> Whether to display
|
|
73
|
+
*/
|
|
74
|
+
filter?: (id: ID, elementType: ElementType) => boolean;
|
|
75
|
+
/**
|
|
76
|
+
* <zh/> 透镜的样式
|
|
77
|
+
*
|
|
78
|
+
* <en/> The style of the lens
|
|
79
|
+
*/
|
|
80
|
+
style?: BaseStyleProps;
|
|
81
|
+
/**
|
|
82
|
+
* <zh/> 在透镜中节点的样式
|
|
83
|
+
*
|
|
84
|
+
* <en/> The style of the nodes displayed in the lens
|
|
85
|
+
*/
|
|
86
|
+
nodeStyle?: NodeStyle | ((datum: NodeData) => NodeStyle);
|
|
87
|
+
/**
|
|
88
|
+
* <zh/> 在透镜中边的样式
|
|
89
|
+
*
|
|
90
|
+
* <en/> The style of the edges displayed in the lens
|
|
91
|
+
*/
|
|
92
|
+
edgeStyle?: EdgeStyle | ((datum: EdgeData) => EdgeStyle);
|
|
93
|
+
/**
|
|
94
|
+
* <zh/> 是否阻止默认事件
|
|
95
|
+
*
|
|
96
|
+
* <en/> Whether to prevent the default event
|
|
97
|
+
* @defaultValue true
|
|
98
|
+
*/
|
|
99
|
+
preventDefault?: boolean;
|
|
100
|
+
}
|
|
101
|
+
export declare class EdgeFilterLens extends BasePlugin<EdgeFilterLensOptions> {
|
|
102
|
+
static defaultOptions: Partial<EdgeFilterLensOptions>;
|
|
103
|
+
constructor(context: RuntimeContext, options: EdgeFilterLensOptions);
|
|
104
|
+
private lens;
|
|
105
|
+
private shapes;
|
|
106
|
+
private r;
|
|
107
|
+
private get canvas();
|
|
108
|
+
private get isLensOn();
|
|
109
|
+
protected onEdgeFilter: (event: IPointerEvent) => void;
|
|
110
|
+
private renderLens;
|
|
111
|
+
private getFilterData;
|
|
112
|
+
private getFocusElements;
|
|
113
|
+
private renderFocusElements;
|
|
114
|
+
private getElementStyle;
|
|
115
|
+
private scaleRByWheel;
|
|
116
|
+
get graphDom(): import("@antv/g").CanvasLike | null;
|
|
117
|
+
private isLensDragging;
|
|
118
|
+
private onDragStart;
|
|
119
|
+
private onDrag;
|
|
120
|
+
private onDragEnd;
|
|
121
|
+
private bindEvents;
|
|
122
|
+
private unbindEvents;
|
|
123
|
+
update(options: Partial<EdgeFilterLensOptions>): void;
|
|
124
|
+
destroy(): void;
|
|
125
|
+
}
|
|
@@ -3,12 +3,14 @@ export { BasePlugin } from './base-plugin';
|
|
|
3
3
|
export { BubbleSets } from './bubble-sets';
|
|
4
4
|
export { CameraSetting } from './camera-setting';
|
|
5
5
|
export { Contextmenu } from './contextmenu';
|
|
6
|
+
export { EdgeFilterLens } from './edge-filter-lens';
|
|
6
7
|
export { Fullscreen } from './fullscreen';
|
|
7
8
|
export { GridLine } from './grid-line';
|
|
8
9
|
export { History } from './history';
|
|
9
10
|
export { Hull } from './hull';
|
|
10
11
|
export { Legend } from './legend';
|
|
11
12
|
export { Minimap } from './minimap';
|
|
13
|
+
export { Snapline } from './snapline';
|
|
12
14
|
export { Timebar } from './timebar';
|
|
13
15
|
export { Toolbar } from './toolbar';
|
|
14
16
|
export { Tooltip } from './tooltip';
|
|
@@ -18,12 +20,14 @@ export type { BasePluginOptions } from './base-plugin';
|
|
|
18
20
|
export type { BubbleSetsOptions } from './bubble-sets';
|
|
19
21
|
export type { CameraSettingOptions } from './camera-setting';
|
|
20
22
|
export type { ContextmenuOptions } from './contextmenu';
|
|
23
|
+
export type { EdgeFilterLensOptions } from './edge-filter-lens';
|
|
21
24
|
export type { FullscreenOptions } from './fullscreen';
|
|
22
25
|
export type { GridLineOptions } from './grid-line';
|
|
23
26
|
export type { HistoryOptions } from './history';
|
|
24
27
|
export type { HullOptions } from './hull';
|
|
25
28
|
export type { LegendOptions } from './legend';
|
|
26
29
|
export type { MinimapOptions } from './minimap';
|
|
30
|
+
export type { SnaplineOptions } from './snapline';
|
|
27
31
|
export type { TimebarOptions } from './timebar';
|
|
28
32
|
export type { ToolbarOptions } from './toolbar';
|
|
29
33
|
export type { TooltipOptions } from './tooltip';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { BaseStyleProps, DisplayObject } from '@antv/g';
|
|
2
|
+
import type { RuntimeContext } from '../../runtime/types';
|
|
3
|
+
import type { IDragEvent, Node } from '../../types';
|
|
4
|
+
import type { BasePluginOptions } from '../base-plugin';
|
|
5
|
+
import { BasePlugin } from '../base-plugin';
|
|
6
|
+
export interface SnaplineOptions extends BasePluginOptions {
|
|
7
|
+
/**
|
|
8
|
+
* <zh/> 对齐精度,即移动节点时与目标位置的距离小于 tolerance 时触发显示对齐线
|
|
9
|
+
*
|
|
10
|
+
* <en/> The alignment accuracy, that is, when the distance between the moved node and the target position is less than tolerance, the alignment line is displayed
|
|
11
|
+
* @defaultValue 5
|
|
12
|
+
*/
|
|
13
|
+
tolerance?: number;
|
|
14
|
+
/**
|
|
15
|
+
* <zh/> 对齐线头尾的延伸距离。取值范围:[0, Infinity]
|
|
16
|
+
*
|
|
17
|
+
* <en/> The extension distance of the snapline. The value range is [0, Infinity]
|
|
18
|
+
* @defaultValue 20
|
|
19
|
+
*/
|
|
20
|
+
offset?: number;
|
|
21
|
+
/**
|
|
22
|
+
* <zh/> 是否启用自动吸附
|
|
23
|
+
*
|
|
24
|
+
* <en/> Whether to enable automatic adsorption
|
|
25
|
+
* @defaultValue true
|
|
26
|
+
*/
|
|
27
|
+
autoSnap?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* <zh/> 指定元素上的哪个图形作为参照图形
|
|
30
|
+
*
|
|
31
|
+
* <en/> Specifies which shape on the element to use as the reference shape
|
|
32
|
+
* @defaultValue `'key'`
|
|
33
|
+
* @remarks
|
|
34
|
+
* <zh/>
|
|
35
|
+
* - 'key' 使用元素的主图形作为参照图形
|
|
36
|
+
* - 也可以传入一个函数,接收元素对象,返回一个图形
|
|
37
|
+
*
|
|
38
|
+
* <en/>
|
|
39
|
+
* - `'key'` uses the key shape of the element as the reference shape
|
|
40
|
+
* - You can also pass in a function that receives the element and returns a shape
|
|
41
|
+
*/
|
|
42
|
+
shape?: string | ((node: Node) => DisplayObject);
|
|
43
|
+
/**
|
|
44
|
+
* <zh/> 垂直对齐线样式
|
|
45
|
+
*
|
|
46
|
+
* <en/> Vertical snapline style
|
|
47
|
+
* @defaultValue `{ stroke: '#1783FF' }`
|
|
48
|
+
*/
|
|
49
|
+
verticalLineStyle?: BaseStyleProps;
|
|
50
|
+
/**
|
|
51
|
+
* <zh/> 水平对齐线样式
|
|
52
|
+
*
|
|
53
|
+
* <en/> Horizontal snapline style
|
|
54
|
+
* @defaultValue `{ stroke: '#1783FF' }`
|
|
55
|
+
*/
|
|
56
|
+
horizontalLineStyle?: BaseStyleProps;
|
|
57
|
+
/**
|
|
58
|
+
* <zh/> 过滤器,用于过滤不需要作为参考的节点
|
|
59
|
+
*
|
|
60
|
+
* <en/> Filter, used to filter nodes that do not need to be used as references
|
|
61
|
+
* @defaultValue `() => true`
|
|
62
|
+
*/
|
|
63
|
+
filter?: (node: Node) => boolean;
|
|
64
|
+
}
|
|
65
|
+
export declare class Snapline extends BasePlugin<SnaplineOptions> {
|
|
66
|
+
static defaultOptions: Partial<SnaplineOptions>;
|
|
67
|
+
private horizontalLine;
|
|
68
|
+
private verticalLine;
|
|
69
|
+
constructor(context: RuntimeContext, options: SnaplineOptions);
|
|
70
|
+
private initSnapline;
|
|
71
|
+
private getNodes;
|
|
72
|
+
private hideSnapline;
|
|
73
|
+
private getLineWidth;
|
|
74
|
+
private updateSnapline;
|
|
75
|
+
private isHorizontalSticking;
|
|
76
|
+
private isVerticalSticking;
|
|
77
|
+
private enableStick;
|
|
78
|
+
private autoSnapToLine;
|
|
79
|
+
/**
|
|
80
|
+
* Get the delta of the drag
|
|
81
|
+
* @param event - drag event object
|
|
82
|
+
* @returns delta
|
|
83
|
+
* @internal
|
|
84
|
+
*/
|
|
85
|
+
protected getDelta(event: IDragEvent<Node>): [number, number] | Float32Array | [number, number, number];
|
|
86
|
+
private enableSnap;
|
|
87
|
+
private calcSnaplineMetadata;
|
|
88
|
+
protected onDragStart: () => void;
|
|
89
|
+
protected onDrag: (event: IDragEvent<Node>) => Promise<void>;
|
|
90
|
+
protected onDragEnd: () => void;
|
|
91
|
+
private bindEvents;
|
|
92
|
+
private unbindEvents;
|
|
93
|
+
private destroyElements;
|
|
94
|
+
destroy(): void;
|
|
95
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DisplayObject } from '@antv/g';
|
|
1
2
|
import type { STDAnimation } from '../animations/types';
|
|
2
3
|
import type { Behavior } from '../behaviors/types';
|
|
3
4
|
import type { Layout } from '../layouts/types';
|
|
@@ -36,4 +37,7 @@ export interface ExtensionRegistry {
|
|
|
36
37
|
transform: Record<string, {
|
|
37
38
|
new (...args: any[]): Transform;
|
|
38
39
|
}>;
|
|
40
|
+
shape: Record<string, {
|
|
41
|
+
new (...args: any[]): DisplayObject;
|
|
42
|
+
}>;
|
|
39
43
|
}
|
|
@@ -6,5 +6,5 @@ export declare class PluginController extends ExtensionController<BasePlugin<Cus
|
|
|
6
6
|
category: "plugin";
|
|
7
7
|
constructor(context: RuntimeContext);
|
|
8
8
|
setPlugins(plugins: PluginOptions): void;
|
|
9
|
-
getPluginInstance(key: string): BasePlugin<CustomPluginOption
|
|
9
|
+
getPluginInstance(key: string): BasePlugin<CustomPluginOption> | undefined;
|
|
10
10
|
}
|
|
@@ -53,5 +53,13 @@ export declare class ViewportController {
|
|
|
53
53
|
* @returns - <zh/> 视口中的包围盒 | <en/> Bounding box in the viewport
|
|
54
54
|
*/
|
|
55
55
|
getBBoxInViewport(bbox: AABB): AABB;
|
|
56
|
+
/**
|
|
57
|
+
* <zh/> 判断点或包围盒是否在视口中
|
|
58
|
+
*
|
|
59
|
+
* <en/> Determine whether the point or bounding box is in the viewport
|
|
60
|
+
* @param target - <zh/> 点或包围盒 | <en/> Point or bounding box
|
|
61
|
+
* @returns - <zh/> 是否在视口中 | <en/> Whether it is in the viewport
|
|
62
|
+
*/
|
|
63
|
+
isInViewport(target: Point | AABB): boolean;
|
|
56
64
|
cancelAnimation(): void;
|
|
57
65
|
}
|
|
@@ -16,6 +16,7 @@ export type * from './padding';
|
|
|
16
16
|
export type * from './placement';
|
|
17
17
|
export type * from './point';
|
|
18
18
|
export type * from './prefix';
|
|
19
|
+
export type * from './router';
|
|
19
20
|
export type * from './size';
|
|
20
21
|
export type * from './state';
|
|
21
22
|
export type * from './style';
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { Padding } from './padding';
|
|
2
|
+
import type { CardinalPlacement } from './placement';
|
|
3
|
+
import { Point } from './point';
|
|
4
|
+
export type Direction = CardinalPlacement;
|
|
5
|
+
export type PolylineRouter = false | OrthRouter | ShortestPathRouter;
|
|
6
|
+
export interface OrthRouter extends OrthRouterOptions {
|
|
7
|
+
/**
|
|
8
|
+
* <zh/> 正交路由,通过在路径上添加额外的控制点,使得边的每一段都保持水平或垂直
|
|
9
|
+
*
|
|
10
|
+
* <en/> Orthogonal routing that adds additional control points on the path to ensure each segment of the edge horizontal or vertical
|
|
11
|
+
* @remarks
|
|
12
|
+
* <zh/> 采用基于节点的相对位置和专家经验得出的寻径算法来模糊计算控制点,非最优解但计算速度快。该路由支持 `controlPoints` 来作为额外的控制点,但不支持自动避障。
|
|
13
|
+
*
|
|
14
|
+
* <en/> It uses a pathfinding algorithm based on the relative position of the nodes and expert experience to calculate the control points, which is not the optimal solution but is fast to calculate. This routing supports `controlPoints` as additional control points, but does not support automatic obstacle avoidance.
|
|
15
|
+
*/
|
|
16
|
+
type: 'orth';
|
|
17
|
+
}
|
|
18
|
+
export interface ShortestPathRouter extends ShortestPathRouterOptions {
|
|
19
|
+
/**
|
|
20
|
+
* <zh/> 最短路径路由,是正交路由 `'orth'` 的智能版本。该路由由水平或垂直的正交线段组成。采用 A* 算法计算最短路径,并支持自动避开路径上的其他节点(障碍)
|
|
21
|
+
*
|
|
22
|
+
* <en/> The shortest path routing is an intelligent version of the orthogonal routing `'orth'`. The routing consists of horizontal or vertical orthogonal line segments. It uses the A* algorithm to calculate the shortest path and supports automatic avoidance of other nodes (obstacles) on the path.
|
|
23
|
+
*/
|
|
24
|
+
type: 'shortest-path';
|
|
25
|
+
}
|
|
26
|
+
export type RouterOptions = OrthRouterOptions | ShortestPathRouterOptions;
|
|
27
|
+
export interface OrthRouterOptions {
|
|
28
|
+
/**
|
|
29
|
+
* <zh/> 指定节点连接点与转角的最小距离
|
|
30
|
+
*
|
|
31
|
+
* <en/> The minimum distance between the node connection point and the corner
|
|
32
|
+
*/
|
|
33
|
+
padding?: Padding;
|
|
34
|
+
}
|
|
35
|
+
export interface ShortestPathRouterOptions {
|
|
36
|
+
/**
|
|
37
|
+
* <zh/> 节点锚点与转角的最小距离
|
|
38
|
+
*
|
|
39
|
+
* <en/> The minimum distance between the node anchor point and the corner
|
|
40
|
+
*/
|
|
41
|
+
offset?: Padding;
|
|
42
|
+
/**
|
|
43
|
+
* <zh/> grid 格子大小
|
|
44
|
+
*
|
|
45
|
+
* <en/> grid size
|
|
46
|
+
*/
|
|
47
|
+
gridSize?: number;
|
|
48
|
+
/**
|
|
49
|
+
* <zh/> 支持的最大旋转角度(弧度)
|
|
50
|
+
*
|
|
51
|
+
* <en/> Maximum allowable rotation angle (radian)
|
|
52
|
+
*/
|
|
53
|
+
maxAllowedDirectionChange?: number;
|
|
54
|
+
/**
|
|
55
|
+
* <zh/> 节点的可能起始方向
|
|
56
|
+
*
|
|
57
|
+
* <en/> Possible starting directions from a node
|
|
58
|
+
*/
|
|
59
|
+
startDirections?: Direction[];
|
|
60
|
+
/**
|
|
61
|
+
* <zh/> 节点的可能结束方向
|
|
62
|
+
*
|
|
63
|
+
* <en/> Possible ending directions from a node
|
|
64
|
+
*/
|
|
65
|
+
endDirections?: Direction[];
|
|
66
|
+
/**
|
|
67
|
+
* <zh/> 指定可移动的方向
|
|
68
|
+
*
|
|
69
|
+
* <en/> Allowed edge directions
|
|
70
|
+
*/
|
|
71
|
+
directionMap?: {
|
|
72
|
+
[key in Direction]: {
|
|
73
|
+
stepX: number;
|
|
74
|
+
stepY: number;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* <zh/> 表示在路径搜索过程中某些路径的额外代价。key 为弧度值,value 为代价
|
|
79
|
+
*
|
|
80
|
+
* <en/> Penalties for direction changes. Key is the radian value, value is the penalty
|
|
81
|
+
*/
|
|
82
|
+
penalties?: {
|
|
83
|
+
[key: string]: number;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* <zh/> 指定计算两点之间距离的函数
|
|
87
|
+
*
|
|
88
|
+
* <en/> Function to calculate the distance between two points
|
|
89
|
+
*/
|
|
90
|
+
distFunc?: (p1: Point, p2: Point) => number;
|
|
91
|
+
/**
|
|
92
|
+
* <zh/> 最大迭代次数
|
|
93
|
+
*
|
|
94
|
+
* <en/> Maximum loops
|
|
95
|
+
*/
|
|
96
|
+
maximumLoops?: number;
|
|
97
|
+
/**
|
|
98
|
+
* <zh/> 是否开启避障
|
|
99
|
+
*
|
|
100
|
+
* <en/> Whether to enable obstacle avoidance while computing the path
|
|
101
|
+
*/
|
|
102
|
+
enableObstacleAvoidance?: boolean;
|
|
103
|
+
}
|
package/dist/lib/utils/bbox.d.ts
CHANGED
|
@@ -116,3 +116,11 @@ export declare function getTriangleCenter(bbox: AABB, direction: TriangleDirecti
|
|
|
116
116
|
* @returns number
|
|
117
117
|
*/
|
|
118
118
|
export declare function getIncircleRadius(bbox: AABB, direction: TriangleDirection): number;
|
|
119
|
+
/**
|
|
120
|
+
* <zh/> 获取包围盒的四条边,顺序依次为上、右、下、左
|
|
121
|
+
*
|
|
122
|
+
* <en/> Get the four segments of the bounding box, in order from top, right, bottom, left
|
|
123
|
+
* @param bbox - <zh/> 包围盒 | <en/> Bounding box
|
|
124
|
+
* @returns <zh/> 包围盒的四条边 | <en/> The four segments of the bounding box
|
|
125
|
+
*/
|
|
126
|
+
export declare function getBBoxSegments(bbox: AABB): [Point, Point][];
|