@antv/g6 5.0.0-beta.5 → 5.0.0-beta.7
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/esm/index.d.ts +15 -7
- package/esm/index.js +1 -1
- package/esm/item/combo.d.ts +1 -1
- package/esm/item/combo.js +16 -9
- package/esm/item/combo.js.map +1 -1
- package/esm/item/edge.d.ts +22 -2
- package/esm/item/edge.js +93 -42
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.js +9 -5
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +1 -1
- package/esm/item/node.js +22 -15
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/data.d.ts +7 -10
- package/esm/runtime/controller/data.js +123 -281
- package/esm/runtime/controller/data.js.map +1 -1
- package/esm/runtime/controller/item.d.ts +1 -0
- package/esm/runtime/controller/item.js +21 -9
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/graph.d.ts +85 -7
- package/esm/runtime/graph.js +396 -61
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/brush-select.js +1 -2
- package/esm/stdlib/behavior/brush-select.js.map +1 -1
- package/esm/stdlib/behavior/create-edge.d.ts +57 -0
- package/esm/stdlib/behavior/create-edge.js +207 -0
- package/esm/stdlib/behavior/create-edge.js.map +1 -0
- package/esm/stdlib/behavior/drag-canvas.d.ts +2 -1
- package/esm/stdlib/behavior/drag-canvas.js +26 -18
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
- package/esm/stdlib/behavior/drag-combo.d.ts +2 -2
- package/esm/stdlib/behavior/drag-combo.js +35 -24
- package/esm/stdlib/behavior/drag-combo.js.map +1 -1
- package/esm/stdlib/behavior/drag-node.d.ts +3 -3
- package/esm/stdlib/behavior/drag-node.js +70 -57
- package/esm/stdlib/behavior/drag-node.js.map +1 -1
- package/esm/stdlib/behavior/index.d.ts +2 -0
- package/esm/stdlib/behavior/index.js +2 -0
- package/esm/stdlib/behavior/index.js.map +1 -1
- package/esm/stdlib/behavior/lasso-select.d.ts +1 -1
- package/esm/stdlib/behavior/lasso-select.js +1 -2
- package/esm/stdlib/behavior/lasso-select.js.map +1 -1
- package/esm/stdlib/behavior/scroll-canvas.d.ts +67 -0
- package/esm/stdlib/behavior/scroll-canvas.js +266 -0
- package/esm/stdlib/behavior/scroll-canvas.js.map +1 -0
- package/esm/stdlib/behavior/zoom-canvas.d.ts +2 -1
- package/esm/stdlib/behavior/zoom-canvas.js +30 -22
- package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/esm/stdlib/data/mapNodeSize.d.ts +2 -2
- package/esm/stdlib/data/mapNodeSize.js +2 -2
- package/esm/stdlib/data/mapNodeSize.js.map +1 -1
- package/esm/stdlib/data/transformV4Data.d.ts +2 -2
- package/esm/stdlib/data/transformV4Data.js +2 -2
- package/esm/stdlib/data/transformV4Data.js.map +1 -1
- package/esm/stdlib/data/validateData.d.ts +2 -2
- package/esm/stdlib/data/validateData.js +9 -9
- package/esm/stdlib/data/validateData.js.map +1 -1
- package/esm/stdlib/index.d.ts +10 -6
- package/esm/stdlib/index.js +5 -1
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/edge/base.js +4 -9
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/plugin/hull/hullComponent.d.ts +1 -1
- package/esm/stdlib/plugin/hull/hullComponent.js +3 -6
- package/esm/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/esm/stdlib/plugin/minimap/index.d.ts +5 -1
- package/esm/stdlib/plugin/minimap/index.js +116 -9
- package/esm/stdlib/plugin/minimap/index.js.map +1 -1
- package/esm/stdlib/plugin/snapline/index.d.ts +5 -1
- package/esm/stdlib/plugin/snapline/index.js +23 -12
- package/esm/stdlib/plugin/snapline/index.js.map +1 -1
- package/esm/types/graph.d.ts +34 -8
- package/esm/types/hook.d.ts +16 -2
- package/esm/types/spec.d.ts +6 -3
- package/esm/types/view.d.ts +5 -0
- package/esm/util/event.d.ts +3 -1
- package/esm/util/event.js +8 -1
- package/esm/util/event.js.map +1 -1
- package/esm/util/item.d.ts +16 -1
- package/esm/util/item.js +31 -8
- package/esm/util/item.js.map +1 -1
- package/esm/util/layout.d.ts +11 -0
- package/esm/util/layout.js +45 -0
- package/esm/util/layout.js.map +1 -1
- package/esm/util/point.js +5 -1
- package/esm/util/point.js.map +1 -1
- package/esm/util/shape.d.ts +1 -1
- package/esm/util/shape.js +3 -7
- package/esm/util/shape.js.map +1 -1
- package/esm/util/warn.d.ts +14 -0
- package/esm/util/warn.js +4 -0
- package/esm/util/warn.js.map +1 -0
- package/lib/index.d.ts +15 -7
- package/lib/index.js +1 -1
- package/lib/item/combo.d.ts +1 -1
- package/lib/item/combo.js +16 -9
- package/lib/item/combo.js.map +1 -1
- package/lib/item/edge.d.ts +22 -2
- package/lib/item/edge.js +92 -41
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.js +9 -5
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +1 -1
- package/lib/item/node.js +22 -15
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/data.d.ts +7 -10
- package/lib/runtime/controller/data.js +123 -281
- package/lib/runtime/controller/data.js.map +1 -1
- package/lib/runtime/controller/item.d.ts +1 -0
- package/lib/runtime/controller/item.js +21 -9
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/graph.d.ts +85 -7
- package/lib/runtime/graph.js +396 -61
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/brush-select.js +1 -2
- package/lib/stdlib/behavior/brush-select.js.map +1 -1
- package/lib/stdlib/behavior/create-edge.d.ts +57 -0
- package/lib/stdlib/behavior/create-edge.js +211 -0
- package/lib/stdlib/behavior/create-edge.js.map +1 -0
- package/lib/stdlib/behavior/drag-canvas.d.ts +2 -1
- package/lib/stdlib/behavior/drag-canvas.js +26 -18
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
- package/lib/stdlib/behavior/drag-combo.d.ts +2 -2
- package/lib/stdlib/behavior/drag-combo.js +35 -24
- package/lib/stdlib/behavior/drag-combo.js.map +1 -1
- package/lib/stdlib/behavior/drag-node.d.ts +3 -3
- package/lib/stdlib/behavior/drag-node.js +70 -57
- package/lib/stdlib/behavior/drag-node.js.map +1 -1
- package/lib/stdlib/behavior/index.d.ts +2 -0
- package/lib/stdlib/behavior/index.js +2 -0
- package/lib/stdlib/behavior/index.js.map +1 -1
- package/lib/stdlib/behavior/lasso-select.d.ts +1 -1
- package/lib/stdlib/behavior/lasso-select.js +1 -2
- package/lib/stdlib/behavior/lasso-select.js.map +1 -1
- package/lib/stdlib/behavior/scroll-canvas.d.ts +67 -0
- package/lib/stdlib/behavior/scroll-canvas.js +270 -0
- package/lib/stdlib/behavior/scroll-canvas.js.map +1 -0
- package/lib/stdlib/behavior/zoom-canvas.d.ts +2 -1
- package/lib/stdlib/behavior/zoom-canvas.js +30 -22
- package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/lib/stdlib/data/mapNodeSize.d.ts +2 -2
- package/lib/stdlib/data/mapNodeSize.js +2 -2
- package/lib/stdlib/data/mapNodeSize.js.map +1 -1
- package/lib/stdlib/data/transformV4Data.d.ts +2 -2
- package/lib/stdlib/data/transformV4Data.js +2 -2
- package/lib/stdlib/data/transformV4Data.js.map +1 -1
- package/lib/stdlib/data/validateData.d.ts +2 -2
- package/lib/stdlib/data/validateData.js +9 -9
- package/lib/stdlib/data/validateData.js.map +1 -1
- package/lib/stdlib/index.d.ts +10 -6
- package/lib/stdlib/index.js +5 -1
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/edge/base.js +4 -9
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/plugin/hull/hullComponent.d.ts +1 -1
- package/lib/stdlib/plugin/hull/hullComponent.js +3 -6
- package/lib/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/lib/stdlib/plugin/minimap/index.d.ts +5 -1
- package/lib/stdlib/plugin/minimap/index.js +116 -9
- package/lib/stdlib/plugin/minimap/index.js.map +1 -1
- package/lib/stdlib/plugin/snapline/index.d.ts +5 -1
- package/lib/stdlib/plugin/snapline/index.js +23 -12
- package/lib/stdlib/plugin/snapline/index.js.map +1 -1
- package/lib/types/graph.d.ts +34 -8
- package/lib/types/hook.d.ts +16 -2
- package/lib/types/spec.d.ts +6 -3
- package/lib/types/view.d.ts +5 -0
- package/lib/util/event.d.ts +3 -1
- package/lib/util/event.js +8 -1
- package/lib/util/event.js.map +1 -1
- package/lib/util/item.d.ts +16 -1
- package/lib/util/item.js +33 -9
- package/lib/util/item.js.map +1 -1
- package/lib/util/layout.d.ts +11 -0
- package/lib/util/layout.js +47 -1
- package/lib/util/layout.js.map +1 -1
- package/lib/util/point.js +5 -1
- package/lib/util/point.js.map +1 -1
- package/lib/util/shape.d.ts +1 -1
- package/lib/util/shape.js +3 -7
- package/lib/util/shape.js.map +1 -1
- package/lib/util/warn.d.ts +14 -0
- package/lib/util/warn.js +8 -0
- package/lib/util/warn.js.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/item/combo.ts +14 -9
- package/src/item/edge.ts +121 -55
- package/src/item/item.ts +13 -9
- package/src/item/node.ts +20 -15
- package/src/runtime/controller/data.ts +139 -339
- package/src/runtime/controller/item.ts +30 -12
- package/src/runtime/graph.ts +502 -67
- package/src/stdlib/behavior/brush-select.ts +4 -2
- package/src/stdlib/behavior/create-edge.ts +296 -0
- package/src/stdlib/behavior/drag-canvas.ts +30 -19
- package/src/stdlib/behavior/drag-combo.ts +2 -2
- package/src/stdlib/behavior/drag-node.ts +8 -8
- package/src/stdlib/behavior/index.ts +2 -0
- package/src/stdlib/behavior/lasso-select.ts +5 -3
- package/src/stdlib/behavior/scroll-canvas.ts +348 -0
- package/src/stdlib/behavior/zoom-canvas.ts +34 -23
- package/src/stdlib/data/mapNodeSize.ts +2 -2
- package/src/stdlib/data/transformV4Data.ts +2 -2
- package/src/stdlib/data/validateData.ts +9 -9
- package/src/stdlib/index.ts +6 -0
- package/src/stdlib/item/edge/base.ts +4 -8
- package/src/stdlib/plugin/hull/hullComponent.ts +8 -5
- package/src/stdlib/plugin/minimap/index.ts +120 -10
- package/src/stdlib/plugin/snapline/index.ts +36 -16
- package/src/types/graph.ts +37 -8
- package/src/types/hook.ts +16 -2
- package/src/types/spec.ts +9 -3
- package/src/types/view.ts +8 -3
- package/src/util/event.ts +14 -1
- package/src/util/item.ts +65 -28
- package/src/util/layout.ts +45 -0
- package/src/util/point.ts +4 -2
- package/src/util/shape.ts +6 -7
- package/src/util/warn.ts +20 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { isBoolean, isNumber, isObject } from '@antv/util';
|
|
2
|
+
import { Behavior } from '../../types/behavior';
|
|
3
|
+
import { ID, IG6GraphEvent } from '../../types';
|
|
4
|
+
|
|
5
|
+
interface ScrollCanvasOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The direction of dragging that is allowed. Options: 'x', 'y', 'both'. 'both' by default.
|
|
8
|
+
*/
|
|
9
|
+
direction?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Whether enable optimize strategies, which will hide all the shapes excluding node keyShape while scrolling.
|
|
12
|
+
*/
|
|
13
|
+
enableOptimize?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* When the zoom ratio of the graph is smaller than ```optimizeZoom```, all shapes except for node keyShape will always be hidden.
|
|
16
|
+
* This option requires ```enableOptimize=true```;
|
|
17
|
+
*/
|
|
18
|
+
optimizeZoom?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Switch to zooming while pressing the key and wheeling. Options: 'shift', 'ctrl', 'alt', 'control', 'meta', using an array of these options allows any of these keys to trigger zooming;
|
|
21
|
+
* Use ```'ctrl'``` by default;
|
|
22
|
+
*/
|
|
23
|
+
zoomKey?: string | string[];
|
|
24
|
+
/** Switch to zooming while pressing the key and wheeling. This option allows you to control the zoom ratio for each event.
|
|
25
|
+
* Use ```'0.05'``` by default;
|
|
26
|
+
*/
|
|
27
|
+
zoomRatio?: number;
|
|
28
|
+
/**
|
|
29
|
+
* The range of canvas to limit dragging, 0 by default, which means the graph cannot be dragged totally out of the view port range.
|
|
30
|
+
* If scalableRange is number or a string without 'px', means it is a ratio of the graph content.
|
|
31
|
+
* If scalableRange is a string with 'px', it is regarded as pixels.
|
|
32
|
+
* If scalableRange = 0, no constrains;
|
|
33
|
+
* If scalableRange > 0, the graph can be dragged out of the view port range
|
|
34
|
+
* If scalableRange < 0, the range is smaller than the view port.
|
|
35
|
+
* Refer to https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*IFfoS67_HssAAAAAAAAAAAAAARQnAQ
|
|
36
|
+
*/
|
|
37
|
+
scalableRange?: string | number;
|
|
38
|
+
/**
|
|
39
|
+
* Whether allow trigger this behavior when drag start on nodes / edges / combos.
|
|
40
|
+
*/
|
|
41
|
+
allowDragOnItem?:
|
|
42
|
+
| boolean
|
|
43
|
+
| {
|
|
44
|
+
node?: boolean;
|
|
45
|
+
edge?: boolean;
|
|
46
|
+
combo?: boolean;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const DEFAULT_OPTIONS: ScrollCanvasOptions = {
|
|
51
|
+
direction: 'both',
|
|
52
|
+
enableOptimize: false,
|
|
53
|
+
zoomKey: 'ctrl',
|
|
54
|
+
scalableRange: 0,
|
|
55
|
+
allowDragOnItem: true,
|
|
56
|
+
zoomRatio: 0.05,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export class ScrollCanvas extends Behavior {
|
|
60
|
+
private hiddenEdgeIds: ID[];
|
|
61
|
+
private hiddenNodeIds: ID[];
|
|
62
|
+
|
|
63
|
+
declare options: ScrollCanvasOptions;
|
|
64
|
+
timeout?: number;
|
|
65
|
+
optimized = false;
|
|
66
|
+
constructor(options: Partial<ScrollCanvasOptions>) {
|
|
67
|
+
const finalOptions = Object.assign({}, DEFAULT_OPTIONS, options, {
|
|
68
|
+
zoomKey: initZoomKey(options.zoomKey),
|
|
69
|
+
});
|
|
70
|
+
super(finalOptions);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
getEvents = () => {
|
|
74
|
+
return {
|
|
75
|
+
wheel: this.onWheel,
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
onWheel(ev: IG6GraphEvent & { deltaX?: number; deltaY?: number }) {
|
|
80
|
+
if (!this.allowDrag(ev)) return;
|
|
81
|
+
const graph = this.graph;
|
|
82
|
+
const { zoomKey, zoomRatio, enableOptimize } = this.options;
|
|
83
|
+
const zoomKeys = Array.isArray(zoomKey) ? [].concat(zoomKey) : [zoomKey];
|
|
84
|
+
if (zoomKeys.includes('control')) zoomKeys.push('ctrl');
|
|
85
|
+
const keyDown = zoomKeys.some((ele) => ev[`${ele}Key`]);
|
|
86
|
+
|
|
87
|
+
const nativeEvent = ev.nativeEvent as
|
|
88
|
+
| (WheelEvent & { wheelDelta: number })
|
|
89
|
+
| undefined;
|
|
90
|
+
|
|
91
|
+
if (keyDown) {
|
|
92
|
+
const canvas = graph.canvas;
|
|
93
|
+
const point = canvas.client2Viewport({ x: ev.client.x, y: ev.client.y });
|
|
94
|
+
let ratio = graph.getZoom();
|
|
95
|
+
if (nativeEvent && nativeEvent.wheelDelta > 0) {
|
|
96
|
+
ratio = ratio + ratio * zoomRatio;
|
|
97
|
+
} else {
|
|
98
|
+
ratio = ratio - ratio * zoomRatio;
|
|
99
|
+
}
|
|
100
|
+
graph.zoomTo(ratio, {
|
|
101
|
+
x: point.x,
|
|
102
|
+
y: point.y,
|
|
103
|
+
});
|
|
104
|
+
} else {
|
|
105
|
+
const diffX = ev.deltaX || ev.movement.x;
|
|
106
|
+
const diffY = ev.deltaY || ev.movement.y;
|
|
107
|
+
|
|
108
|
+
const { dx, dy } = this.formatDisplacement(diffX, diffY);
|
|
109
|
+
graph.translate({ dx: -dx, dy: -dy });
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (enableOptimize) {
|
|
113
|
+
const optimized = this.optimized;
|
|
114
|
+
|
|
115
|
+
// hiding
|
|
116
|
+
if (!optimized) {
|
|
117
|
+
this.hideShapes();
|
|
118
|
+
this.optimized = true;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// showing after 100ms
|
|
122
|
+
clearTimeout(this.timeout);
|
|
123
|
+
this.timeout = undefined;
|
|
124
|
+
const timeout = window.setTimeout(() => {
|
|
125
|
+
this.showShapes();
|
|
126
|
+
this.optimized = false;
|
|
127
|
+
}, 100);
|
|
128
|
+
this.timeout = timeout;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
private formatDisplacement(dx: number, dy: number) {
|
|
132
|
+
const { graph } = this;
|
|
133
|
+
const { scalableRange, direction } = this.options;
|
|
134
|
+
const [width, height] = graph.getSize();
|
|
135
|
+
const graphBBox = graph.canvas.getRoot().getRenderBounds();
|
|
136
|
+
let rangeNum = Number(scalableRange);
|
|
137
|
+
let isPixel;
|
|
138
|
+
if (typeof scalableRange === 'string') {
|
|
139
|
+
if (scalableRange.includes('px')) {
|
|
140
|
+
isPixel = scalableRange.includes('px');
|
|
141
|
+
rangeNum = Number(scalableRange.replace('px', ''));
|
|
142
|
+
}
|
|
143
|
+
if (scalableRange.includes('%')) {
|
|
144
|
+
rangeNum = Number(scalableRange.replace('%', '')) / 100;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
let expandWidth = rangeNum;
|
|
149
|
+
let expandHeight = rangeNum;
|
|
150
|
+
// If it is not a string with 'px', regard as ratio
|
|
151
|
+
if (!isPixel) {
|
|
152
|
+
expandWidth = width * rangeNum;
|
|
153
|
+
expandHeight = height * rangeNum;
|
|
154
|
+
}
|
|
155
|
+
const leftTopClient = graph.getViewportByCanvas({
|
|
156
|
+
x: graphBBox.min[0],
|
|
157
|
+
y: graphBBox.min[1],
|
|
158
|
+
});
|
|
159
|
+
const rightBottomClient = graph.getViewportByCanvas({
|
|
160
|
+
x: graphBBox.max[0],
|
|
161
|
+
y: graphBBox.max[1],
|
|
162
|
+
});
|
|
163
|
+
const minX = leftTopClient.x;
|
|
164
|
+
const minY = leftTopClient.y;
|
|
165
|
+
const maxX = rightBottomClient.x;
|
|
166
|
+
const maxY = rightBottomClient.y;
|
|
167
|
+
if (dx > 0) {
|
|
168
|
+
if (maxX < -expandWidth) {
|
|
169
|
+
dx = 0;
|
|
170
|
+
} else if (maxX - dx < -expandWidth) {
|
|
171
|
+
dx = maxX + expandWidth;
|
|
172
|
+
}
|
|
173
|
+
} else if (dx < 0) {
|
|
174
|
+
if (minX > width + expandWidth) {
|
|
175
|
+
dx = 0;
|
|
176
|
+
} else if (minX - dx > width + expandWidth) {
|
|
177
|
+
dx = minX - (width + expandWidth);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (dy > 0) {
|
|
182
|
+
if (maxY < -expandHeight) {
|
|
183
|
+
dy = 0;
|
|
184
|
+
} else if (maxY - dy < -expandHeight) {
|
|
185
|
+
dy = maxY + expandHeight;
|
|
186
|
+
}
|
|
187
|
+
} else if (dy < 0) {
|
|
188
|
+
if (minY > height + expandHeight) {
|
|
189
|
+
dy = 0;
|
|
190
|
+
} else if (minY - dy > height + expandHeight) {
|
|
191
|
+
dy = minY - (height + expandHeight);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (direction === 'x') {
|
|
196
|
+
dy = 0;
|
|
197
|
+
} else if (direction === 'y') {
|
|
198
|
+
dx = 0;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return { dx, dy };
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
private allowDrag(evt: IG6GraphEvent) {
|
|
205
|
+
const { itemType } = evt;
|
|
206
|
+
const { allowDragOnItem } = this.options;
|
|
207
|
+
const targetIsCanvas = itemType === 'canvas';
|
|
208
|
+
if (isBoolean(allowDragOnItem) && !allowDragOnItem && !targetIsCanvas)
|
|
209
|
+
return false;
|
|
210
|
+
if (isObject(allowDragOnItem)) {
|
|
211
|
+
const { node, edge, combo } = allowDragOnItem;
|
|
212
|
+
if (!node && itemType === 'node') return false;
|
|
213
|
+
if (!edge && itemType === 'edge') return false;
|
|
214
|
+
if (!combo && itemType === 'combo') return false;
|
|
215
|
+
}
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
private hideShapes() {
|
|
220
|
+
const { graph, options } = this;
|
|
221
|
+
const { tileBehavior: graphBehaviorOptimize, tileBehaviorSize = 1000 } =
|
|
222
|
+
graph.getSpecification().optimize || {};
|
|
223
|
+
const { optimizeZoom } = options;
|
|
224
|
+
const optimize = this.options.enableOptimize || graphBehaviorOptimize;
|
|
225
|
+
const shouldOptimzie = isNumber(optimize)
|
|
226
|
+
? graph.getAllNodesData().length > optimize
|
|
227
|
+
: optimize;
|
|
228
|
+
if (shouldOptimzie) {
|
|
229
|
+
const currentZoom = graph.getZoom();
|
|
230
|
+
const newHiddenEdgeIds = graph
|
|
231
|
+
.getAllEdgesData()
|
|
232
|
+
.map((edge) => edge.id)
|
|
233
|
+
.filter((id) => graph.getItemVisible(id));
|
|
234
|
+
graph.hideItem(newHiddenEdgeIds, true);
|
|
235
|
+
|
|
236
|
+
if (currentZoom < optimizeZoom) {
|
|
237
|
+
this.hiddenEdgeIds.push(...newHiddenEdgeIds);
|
|
238
|
+
} else {
|
|
239
|
+
this.hiddenEdgeIds = newHiddenEdgeIds;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const newHiddenNodeIds = graph
|
|
243
|
+
.getAllNodesData()
|
|
244
|
+
.map((node) => node.id)
|
|
245
|
+
.filter((id) => graph.getItemVisible(id));
|
|
246
|
+
|
|
247
|
+
let requestId;
|
|
248
|
+
const sectionNum = Math.ceil(newHiddenNodeIds.length / tileBehaviorSize);
|
|
249
|
+
const sections = Array.from({ length: sectionNum }, (v, i) =>
|
|
250
|
+
newHiddenNodeIds.slice(
|
|
251
|
+
i * tileBehaviorSize,
|
|
252
|
+
i * tileBehaviorSize + tileBehaviorSize,
|
|
253
|
+
),
|
|
254
|
+
);
|
|
255
|
+
const update = () => {
|
|
256
|
+
if (!sections.length) {
|
|
257
|
+
cancelAnimationFrame(requestId);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
const section = sections.shift();
|
|
261
|
+
graph.startHistoryBatch();
|
|
262
|
+
graph.hideItem(section, false, true);
|
|
263
|
+
graph.stopHistoryBatch();
|
|
264
|
+
requestId = requestAnimationFrame(update);
|
|
265
|
+
};
|
|
266
|
+
requestId = requestAnimationFrame(update);
|
|
267
|
+
|
|
268
|
+
if (currentZoom < optimizeZoom) {
|
|
269
|
+
this.hiddenNodeIds.push(...newHiddenNodeIds);
|
|
270
|
+
} else {
|
|
271
|
+
this.hiddenNodeIds = newHiddenNodeIds;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
private showShapes() {
|
|
276
|
+
const { graph, hiddenEdgeIds, hiddenNodeIds } = this;
|
|
277
|
+
const currentZoom = graph.getZoom();
|
|
278
|
+
const { optimizeZoom } = this.options;
|
|
279
|
+
|
|
280
|
+
// hide the shapes when the zoom ratio is smaller than optimizeZoom
|
|
281
|
+
// hide the shapes when zoomming
|
|
282
|
+
if (currentZoom < optimizeZoom) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
const { tileBehavior: graphBehaviorOptimize, tileBehaviorSize = 1000 } =
|
|
287
|
+
graph.getSpecification().optimize || {};
|
|
288
|
+
const optimize = this.options.enableOptimize || graphBehaviorOptimize;
|
|
289
|
+
const shouldOptimzie = isNumber(optimize)
|
|
290
|
+
? graph.getAllNodesData().length > optimize
|
|
291
|
+
: optimize;
|
|
292
|
+
if (!shouldOptimzie) {
|
|
293
|
+
this.hiddenEdgeIds = this.hiddenNodeIds = [];
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
let requestId;
|
|
298
|
+
const hiddenIds = [...hiddenNodeIds, ...hiddenEdgeIds];
|
|
299
|
+
const sectionNum = Math.ceil(hiddenIds.length / tileBehaviorSize);
|
|
300
|
+
const sections = Array.from({ length: sectionNum }, (v, i) =>
|
|
301
|
+
hiddenIds.slice(
|
|
302
|
+
i * tileBehaviorSize,
|
|
303
|
+
i * tileBehaviorSize + tileBehaviorSize,
|
|
304
|
+
),
|
|
305
|
+
);
|
|
306
|
+
const update = () => {
|
|
307
|
+
if (!sections.length) {
|
|
308
|
+
cancelAnimationFrame(requestId);
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
graph.executeWithNoStack(() => {
|
|
312
|
+
graph.showItem(sections.shift(), false);
|
|
313
|
+
});
|
|
314
|
+
requestId = requestAnimationFrame(update);
|
|
315
|
+
};
|
|
316
|
+
requestId = requestAnimationFrame(update);
|
|
317
|
+
|
|
318
|
+
this.hiddenEdgeIds = this.hiddenNodeIds = [];
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
const ALLOW_EVENTS = ['shift', 'ctrl', 'alt', 'control', 'meta'];
|
|
323
|
+
|
|
324
|
+
function initZoomKey(zoomKey?: string | string[]) {
|
|
325
|
+
const zoomKeys = zoomKey
|
|
326
|
+
? Array.isArray(zoomKey)
|
|
327
|
+
? zoomKey
|
|
328
|
+
: [zoomKey]
|
|
329
|
+
: [];
|
|
330
|
+
|
|
331
|
+
const validZoomKeys = zoomKeys.filter((zoomKey) => {
|
|
332
|
+
const keyIsValid = ALLOW_EVENTS.includes(zoomKey);
|
|
333
|
+
if (!keyIsValid)
|
|
334
|
+
console.warn(
|
|
335
|
+
`Invalid zoomKey: ${zoomKey}, please use a valid zoomKey: ${JSON.stringify(
|
|
336
|
+
ALLOW_EVENTS,
|
|
337
|
+
)}`,
|
|
338
|
+
);
|
|
339
|
+
|
|
340
|
+
return keyIsValid;
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
if (validZoomKeys.length === 0) {
|
|
344
|
+
validZoomKeys.push('ctrl');
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
return validZoomKeys;
|
|
348
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ID, IG6GraphEvent } from 'types';
|
|
2
|
-
import { Behavior } from '../../types/behavior';
|
|
3
1
|
import { isNumber } from '@antv/util';
|
|
2
|
+
import { ID, IG6GraphEvent } from '../../types';
|
|
3
|
+
import { Behavior } from '../../types/behavior';
|
|
4
4
|
|
|
5
5
|
const VALID_TRIGGERS = ['wheel', 'upDownKeys'];
|
|
6
6
|
export interface ZoomCanvasOptions {
|
|
@@ -76,6 +76,7 @@ export class ZoomCanvas extends Behavior {
|
|
|
76
76
|
private hiddenEdgeIds: ID[];
|
|
77
77
|
private hiddenNodeIds: ID[];
|
|
78
78
|
private zoomTimer: ReturnType<typeof setTimeout>;
|
|
79
|
+
private tileRequestId?: number;
|
|
79
80
|
|
|
80
81
|
constructor(options: Partial<ZoomCanvasOptions>) {
|
|
81
82
|
const finalOptions = Object.assign({}, DEFAULT_OPTIONS, options);
|
|
@@ -117,11 +118,14 @@ export class ZoomCanvas extends Behavior {
|
|
|
117
118
|
const { graph } = this;
|
|
118
119
|
const { tileBehavior: graphBehaviorOptimize, tileBehaviorSize = 1000 } =
|
|
119
120
|
graph.getSpecification().optimize || {};
|
|
120
|
-
const optimize =
|
|
121
|
-
|
|
121
|
+
const optimize =
|
|
122
|
+
this.options.enableOptimize !== undefined
|
|
123
|
+
? this.options.enableOptimize
|
|
124
|
+
: graphBehaviorOptimize;
|
|
125
|
+
const shouldOptimze = isNumber(optimize)
|
|
122
126
|
? graph.getAllNodesData().length > optimize
|
|
123
127
|
: optimize;
|
|
124
|
-
if (
|
|
128
|
+
if (shouldOptimze) {
|
|
125
129
|
this.hiddenEdgeIds = graph
|
|
126
130
|
.getAllEdgesData()
|
|
127
131
|
.map((edge) => edge.id)
|
|
@@ -131,7 +135,6 @@ export class ZoomCanvas extends Behavior {
|
|
|
131
135
|
.map((node) => node.id)
|
|
132
136
|
.filter((id) => graph.getItemVisible(id) === true);
|
|
133
137
|
|
|
134
|
-
let requestId;
|
|
135
138
|
const hiddenIds = [...this.hiddenNodeIds];
|
|
136
139
|
const sectionNum = Math.ceil(hiddenIds.length / tileBehaviorSize);
|
|
137
140
|
const sections = Array.from({ length: sectionNum }, (v, i) =>
|
|
@@ -141,17 +144,18 @@ export class ZoomCanvas extends Behavior {
|
|
|
141
144
|
),
|
|
142
145
|
);
|
|
143
146
|
const update = () => {
|
|
144
|
-
if (!sections.length) {
|
|
145
|
-
cancelAnimationFrame(
|
|
147
|
+
if (!sections.length && this.tileRequestId) {
|
|
148
|
+
cancelAnimationFrame(this.tileRequestId);
|
|
149
|
+
this.tileRequestId = undefined;
|
|
146
150
|
return;
|
|
147
151
|
}
|
|
148
152
|
const section = sections.shift();
|
|
153
|
+
graph.startHistoryBatch();
|
|
149
154
|
graph.hideItem(section, false, true);
|
|
150
|
-
|
|
155
|
+
graph.stopHistoryBatch();
|
|
156
|
+
this.tileRequestId = requestAnimationFrame(update);
|
|
151
157
|
};
|
|
152
|
-
|
|
153
|
-
requestId = requestAnimationFrame(update);
|
|
154
|
-
graph.stopHistoryBatch();
|
|
158
|
+
this.tileRequestId = requestAnimationFrame(update);
|
|
155
159
|
}
|
|
156
160
|
}
|
|
157
161
|
|
|
@@ -159,14 +163,20 @@ export class ZoomCanvas extends Behavior {
|
|
|
159
163
|
const { graph, hiddenEdgeIds = [], hiddenNodeIds } = this;
|
|
160
164
|
const { tileBehavior: graphBehaviorOptimize, tileBehaviorSize = 1000 } =
|
|
161
165
|
graph.getSpecification().optimize || {};
|
|
162
|
-
const optimize =
|
|
163
|
-
|
|
166
|
+
const optimize =
|
|
167
|
+
this.options.enableOptimize !== undefined
|
|
168
|
+
? this.options.enableOptimize
|
|
169
|
+
: graphBehaviorOptimize;
|
|
170
|
+
const shouldOptimze = isNumber(optimize)
|
|
164
171
|
? graph.getAllNodesData().length > optimize
|
|
165
172
|
: optimize;
|
|
166
173
|
this.zooming = false;
|
|
167
|
-
if (
|
|
174
|
+
if (shouldOptimze) {
|
|
175
|
+
if (this.tileRequestId) {
|
|
176
|
+
cancelAnimationFrame(this.tileRequestId);
|
|
177
|
+
this.tileRequestId = undefined;
|
|
178
|
+
}
|
|
168
179
|
if (hiddenNodeIds) {
|
|
169
|
-
let requestId;
|
|
170
180
|
const hiddenIds = [...hiddenNodeIds, ...hiddenEdgeIds];
|
|
171
181
|
const sectionNum = Math.ceil(hiddenIds.length / tileBehaviorSize);
|
|
172
182
|
const sections = Array.from({ length: sectionNum }, (v, i) =>
|
|
@@ -176,16 +186,17 @@ export class ZoomCanvas extends Behavior {
|
|
|
176
186
|
),
|
|
177
187
|
);
|
|
178
188
|
const update = () => {
|
|
179
|
-
if (!sections.length) {
|
|
180
|
-
cancelAnimationFrame(
|
|
189
|
+
if (!sections.length && this.tileRequestId) {
|
|
190
|
+
cancelAnimationFrame(this.tileRequestId);
|
|
191
|
+
this.tileRequestId = undefined;
|
|
181
192
|
return;
|
|
182
193
|
}
|
|
183
|
-
graph.
|
|
184
|
-
|
|
194
|
+
graph.executeWithNoStack(() => {
|
|
195
|
+
graph.showItem(sections.shift(), false);
|
|
196
|
+
});
|
|
197
|
+
this.tileRequestId = requestAnimationFrame(update);
|
|
185
198
|
};
|
|
186
|
-
|
|
187
|
-
requestId = requestAnimationFrame(update);
|
|
188
|
-
});
|
|
199
|
+
this.tileRequestId = requestAnimationFrame(update);
|
|
189
200
|
}
|
|
190
201
|
}
|
|
191
202
|
this.hiddenEdgeIds = [];
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
/**
|
|
10
10
|
* Validate and format the graph data.
|
|
11
11
|
* @param data input user data.
|
|
12
|
-
* @param
|
|
12
|
+
* @param graphCore the graph core stores the previous data.
|
|
13
13
|
* @returns formatted data.
|
|
14
14
|
*/
|
|
15
15
|
export const MapNodeSize = (
|
|
@@ -18,7 +18,7 @@ export const MapNodeSize = (
|
|
|
18
18
|
field?: string;
|
|
19
19
|
range?: [number, number];
|
|
20
20
|
} = {},
|
|
21
|
-
|
|
21
|
+
graphCore?: GraphCore,
|
|
22
22
|
): GraphData => {
|
|
23
23
|
const { field, range = [8, 40] } = options;
|
|
24
24
|
if (!field) return data;
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
/**
|
|
11
11
|
* Validate and format the graph data.
|
|
12
12
|
* @param data input user data.
|
|
13
|
-
* @param
|
|
13
|
+
* @param graphCore the graph core stores the previous data.
|
|
14
14
|
* @returns formatted data.
|
|
15
15
|
*/
|
|
16
16
|
export const TransformV4Data = (
|
|
17
17
|
data: GraphData,
|
|
18
18
|
options = {},
|
|
19
|
-
|
|
19
|
+
graphCore?: GraphCore,
|
|
20
20
|
): GraphData => {
|
|
21
21
|
const { nodes = [], edges = [], combos = [] } = data;
|
|
22
22
|
const formattedNodes = nodes.map((node: any) => {
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
/**
|
|
11
11
|
* Validate and format the graph data.
|
|
12
12
|
* @param data input user data.
|
|
13
|
-
* @param
|
|
13
|
+
* @param graphCore the graph core stores the previous data.
|
|
14
14
|
* @returns formatted data.
|
|
15
15
|
*/
|
|
16
16
|
export const ValidateData = (
|
|
17
17
|
data: GraphData,
|
|
18
18
|
options = {},
|
|
19
|
-
|
|
19
|
+
graphCore?: GraphCore,
|
|
20
20
|
): GraphData => {
|
|
21
21
|
const { nodes, edges, combos } = data;
|
|
22
22
|
const idMap = new Map();
|
|
@@ -64,7 +64,7 @@ export const ValidateData = (
|
|
|
64
64
|
if (
|
|
65
65
|
parentId !== undefined &&
|
|
66
66
|
!comboIdMap.has(parentId) &&
|
|
67
|
-
(!
|
|
67
|
+
(!graphCore || !graphCore.hasNode(parentId))
|
|
68
68
|
) {
|
|
69
69
|
console.error(
|
|
70
70
|
`The parentId of combo with id ${combo.id} will be removed since it is not exist in combos.`,
|
|
@@ -80,9 +80,9 @@ export const ValidateData = (
|
|
|
80
80
|
if (
|
|
81
81
|
parentId !== undefined &&
|
|
82
82
|
!comboIdMap.has(parentId) &&
|
|
83
|
-
(!
|
|
83
|
+
(!graphCore || !graphCore.hasNode(parentId))
|
|
84
84
|
) {
|
|
85
|
-
// TODO: parentId is a node in
|
|
85
|
+
// TODO: parentId is a node in graphCore
|
|
86
86
|
console.error(
|
|
87
87
|
`The parentId of node with id ${node.id} will be removed since it is not exist in combos.`,
|
|
88
88
|
);
|
|
@@ -100,8 +100,8 @@ export const ValidateData = (
|
|
|
100
100
|
let { source, target } = edge;
|
|
101
101
|
if (!idAndDataCheck(edge, 'edge', true)) return false;
|
|
102
102
|
|
|
103
|
-
if (
|
|
104
|
-
const existEdge =
|
|
103
|
+
if (graphCore?.hasEdge(id)) {
|
|
104
|
+
const existEdge = graphCore?.getEdge(id);
|
|
105
105
|
if (source === undefined) source = existEdge.source;
|
|
106
106
|
if (target === undefined) target = existEdge.target;
|
|
107
107
|
}
|
|
@@ -121,7 +121,7 @@ export const ValidateData = (
|
|
|
121
121
|
if (
|
|
122
122
|
!nodeIdMap.has(source) &&
|
|
123
123
|
!comboIdMap.has(source) &&
|
|
124
|
-
(!
|
|
124
|
+
(!graphCore || !graphCore.hasNode(source))
|
|
125
125
|
) {
|
|
126
126
|
console.error(
|
|
127
127
|
`The edge with id ${id} will be ignored since its source ${source} is not existed in nodes and combos.`,
|
|
@@ -131,7 +131,7 @@ export const ValidateData = (
|
|
|
131
131
|
if (
|
|
132
132
|
!nodeIdMap.has(target) &&
|
|
133
133
|
!comboIdMap.has(target) &&
|
|
134
|
-
(!
|
|
134
|
+
(!graphCore || !graphCore.hasNode(target))
|
|
135
135
|
) {
|
|
136
136
|
console.error(
|
|
137
137
|
`The edge with id ${id} will be ignored since its target ${target} is not existed in nodes and combos.`,
|
package/src/stdlib/index.ts
CHANGED
|
@@ -61,7 +61,9 @@ const {
|
|
|
61
61
|
DragNode,
|
|
62
62
|
DragCombo,
|
|
63
63
|
ClickSelect,
|
|
64
|
+
CreateEdge,
|
|
64
65
|
ShortcutsCall,
|
|
66
|
+
ScrollCanvas,
|
|
65
67
|
} = Behaviors;
|
|
66
68
|
const {
|
|
67
69
|
History,
|
|
@@ -121,6 +123,7 @@ const stdLib = {
|
|
|
121
123
|
'zoom-canvas': ZoomCanvas,
|
|
122
124
|
'drag-node': DragNode,
|
|
123
125
|
'drag-combo': DragCombo,
|
|
126
|
+
'create-edge': CreateEdge,
|
|
124
127
|
'collapse-expand-combo': CollapseExpandCombo,
|
|
125
128
|
'collapse-expand-tree': CollapseExpandTree,
|
|
126
129
|
'click-select': ClickSelect,
|
|
@@ -135,6 +138,7 @@ const stdLib = {
|
|
|
135
138
|
},
|
|
136
139
|
edges: {
|
|
137
140
|
'line-edge': LineEdge,
|
|
141
|
+
'loop-edge': LoopEdge,
|
|
138
142
|
},
|
|
139
143
|
combos: {
|
|
140
144
|
'circle-combo': CircleCombo,
|
|
@@ -269,7 +273,9 @@ const Extensions = {
|
|
|
269
273
|
CollapseExpandCombo,
|
|
270
274
|
DragNode,
|
|
271
275
|
DragCombo,
|
|
276
|
+
CreateEdge,
|
|
272
277
|
ShortcutsCall,
|
|
278
|
+
ScrollCanvas,
|
|
273
279
|
// plugins
|
|
274
280
|
BasePlugin,
|
|
275
281
|
History,
|
|
@@ -686,12 +686,9 @@ export abstract class BaseEdge {
|
|
|
686
686
|
resultStyle[`${markerField}Offset`] = 0;
|
|
687
687
|
return;
|
|
688
688
|
}
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
} else {
|
|
693
|
-
arrowStyle = arrowConfig;
|
|
694
|
-
}
|
|
689
|
+
const arrowStyle = isBoolean(arrowConfig)
|
|
690
|
+
? ({ ...DEFAULT_ARROW_CONFIG } as ArrowStyle)
|
|
691
|
+
: arrowConfig;
|
|
695
692
|
const {
|
|
696
693
|
type = 'triangle',
|
|
697
694
|
width = 10,
|
|
@@ -700,14 +697,13 @@ export abstract class BaseEdge {
|
|
|
700
697
|
offset = 0,
|
|
701
698
|
...others
|
|
702
699
|
} = arrowStyle;
|
|
703
|
-
const path = propPath ? propPath : getArrowPath(type, width, height);
|
|
704
700
|
resultStyle[markerField] = this.upsertShape(
|
|
705
701
|
'path',
|
|
706
702
|
`${markerField}Shape`,
|
|
707
703
|
{
|
|
708
704
|
...bodyStyle,
|
|
709
705
|
fill: type === 'simple' ? '' : bodyStyle.stroke,
|
|
710
|
-
path,
|
|
706
|
+
path: propPath || getArrowPath(type, width, height),
|
|
711
707
|
anchor: '0.5 0.5',
|
|
712
708
|
transformOrigin: 'center',
|
|
713
709
|
...others,
|
|
@@ -51,7 +51,8 @@ interface HullComponentFullOptions extends HullComponentOptions {
|
|
|
51
51
|
export default class Hull {
|
|
52
52
|
graph: IGraph;
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
// TODO: PathArray is not exported by @antv/util 2.x but by 3.x. Correct the type String | PathArray after upgrading @antv/util
|
|
55
|
+
path: any;
|
|
55
56
|
|
|
56
57
|
members: (NodeModel | ComboModel)[];
|
|
57
58
|
|
|
@@ -172,9 +173,9 @@ export default class Hull {
|
|
|
172
173
|
const shape = this.graph.drawTransient('path', this.options.id, {
|
|
173
174
|
style: {
|
|
174
175
|
path: this.path,
|
|
176
|
+
pointerEvents: 'none',
|
|
175
177
|
...this.options.style,
|
|
176
178
|
},
|
|
177
|
-
capture: false,
|
|
178
179
|
});
|
|
179
180
|
const { labelShape } = this.options;
|
|
180
181
|
if (labelShape?.text) {
|
|
@@ -183,10 +184,10 @@ export default class Hull {
|
|
|
183
184
|
const formattedLabelStyle = this.getLabelStyle(labelShape, shapeBounds);
|
|
184
185
|
this.graph.drawTransient('text', `${this.options.id}-label`, {
|
|
185
186
|
style: {
|
|
187
|
+
pointerEvents: 'none',
|
|
186
188
|
...labelShapeStyle,
|
|
187
189
|
...formattedLabelStyle,
|
|
188
190
|
},
|
|
189
|
-
capture: false,
|
|
190
191
|
});
|
|
191
192
|
}
|
|
192
193
|
shape.toBack();
|
|
@@ -426,8 +427,10 @@ export default class Hull {
|
|
|
426
427
|
|
|
427
428
|
public updateStyle(style: ShapeStyle) {
|
|
428
429
|
this.graph.drawTransient('path', this.options.id, {
|
|
429
|
-
style
|
|
430
|
-
|
|
430
|
+
style: {
|
|
431
|
+
...style,
|
|
432
|
+
pointerEvents: 'none',
|
|
433
|
+
},
|
|
431
434
|
});
|
|
432
435
|
}
|
|
433
436
|
|