@antv/g6 5.0.0-beta.26 → 5.0.0-beta.27
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/constant/shape.d.ts +1 -1
- package/esm/index.d.ts +3 -1
- package/esm/index.js +1 -1
- package/esm/item/combo.d.ts +6 -4
- package/esm/item/combo.js +10 -3
- package/esm/item/combo.js.map +1 -1
- package/esm/item/edge.d.ts +12 -4
- package/esm/item/edge.js +100 -17
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.d.ts +18 -8
- package/esm/item/item.js +103 -59
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +10 -4
- package/esm/item/node.js +92 -8
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/data.d.ts +5 -1
- package/esm/runtime/controller/data.js +38 -1
- package/esm/runtime/controller/data.js.map +1 -1
- package/esm/runtime/controller/index.d.ts +1 -1
- package/esm/runtime/controller/index.js +1 -1
- package/esm/runtime/controller/index.js.map +1 -1
- package/esm/runtime/controller/item.d.ts +22 -11
- package/esm/runtime/controller/item.js +241 -96
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/controller/layout.d.ts +3 -0
- package/esm/runtime/controller/layout.js +178 -98
- package/esm/runtime/controller/layout.js.map +1 -1
- package/esm/runtime/controller/plugin.d.ts +3 -0
- package/esm/runtime/controller/plugin.js +66 -24
- package/esm/runtime/controller/plugin.js.map +1 -1
- package/esm/runtime/controller/viewport.js +9 -2
- package/esm/runtime/controller/viewport.js.map +1 -1
- package/esm/runtime/graph.d.ts +57 -26
- package/esm/runtime/graph.js +263 -139
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/click-select.js +9 -3
- package/esm/stdlib/behavior/click-select.js.map +1 -1
- package/esm/stdlib/behavior/drag-canvas.js +6 -3
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
- package/esm/stdlib/behavior/drag-combo.js +8 -8
- package/esm/stdlib/behavior/drag-combo.js.map +1 -1
- package/esm/stdlib/behavior/drag-node.d.ts +4 -0
- package/esm/stdlib/behavior/drag-node.js +121 -27
- package/esm/stdlib/behavior/drag-node.js.map +1 -1
- package/esm/stdlib/behavior/scroll-canvas.js +3 -3
- package/esm/stdlib/behavior/scroll-canvas.js.map +1 -1
- package/esm/stdlib/behavior/zoom-canvas.js +3 -3
- package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/esm/stdlib/data/mapNodeSize.js +2 -2
- package/esm/stdlib/data/mapNodeSize.js.map +1 -1
- package/esm/stdlib/data/validateData.js +2 -2
- package/esm/stdlib/data/validateData.js.map +1 -1
- package/esm/stdlib/index.d.ts +2 -0
- package/esm/stdlib/index.js +3 -1
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/edge/base.d.ts +2 -11
- package/esm/stdlib/item/edge/base.js +12 -105
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/node/base.d.ts +2 -20
- package/esm/stdlib/item/node/base.js +10 -150
- package/esm/stdlib/item/node/base.js.map +1 -1
- package/esm/stdlib/plugin/edgeFilterLens/index.js +2 -2
- package/esm/stdlib/plugin/edgeFilterLens/index.js.map +1 -1
- package/esm/stdlib/plugin/fisheye/index.js +3 -2
- package/esm/stdlib/plugin/fisheye/index.js.map +1 -1
- package/esm/stdlib/plugin/history/visibility-updated-command.js +2 -2
- package/esm/stdlib/plugin/history/visibility-updated-command.js.map +1 -1
- package/esm/stdlib/plugin/hull/index.d.ts +1 -1
- package/esm/stdlib/plugin/index.d.ts +1 -0
- package/esm/stdlib/plugin/index.js +1 -0
- package/esm/stdlib/plugin/index.js.map +1 -1
- package/esm/stdlib/plugin/lodController/index.d.ts +73 -0
- package/esm/stdlib/plugin/lodController/index.js +556 -0
- package/esm/stdlib/plugin/lodController/index.js.map +1 -0
- package/esm/stdlib/plugin/minimap/index.js +12 -14
- package/esm/stdlib/plugin/minimap/index.js.map +1 -1
- package/esm/stdlib/plugin/toolbar/index.d.ts +2 -2
- package/esm/stdlib/plugin/toolbar/index.js +27 -29
- package/esm/stdlib/plugin/toolbar/index.js.map +1 -1
- package/esm/stdlib/theme/dark.js +32 -35
- package/esm/stdlib/theme/dark.js.map +1 -1
- package/esm/stdlib/theme/light.js +27 -30
- package/esm/stdlib/theme/light.js.map +1 -1
- package/esm/stdlib/themeSolver/spec.js +2 -2
- package/esm/stdlib/themeSolver/spec.js.map +1 -1
- package/esm/types/animate.d.ts +1 -1
- package/esm/types/combo.d.ts +2 -2
- package/esm/types/edge.d.ts +2 -2
- package/esm/types/graph.d.ts +62 -43
- package/esm/types/hook.d.ts +5 -0
- package/esm/types/item.d.ts +9 -15
- package/esm/types/layout.d.ts +7 -2
- package/esm/types/layout.js.map +1 -1
- package/esm/types/node.d.ts +3 -2
- package/esm/types/plugin.d.ts +1 -0
- package/esm/types/plugin.js +1 -0
- package/esm/types/plugin.js.map +1 -1
- package/esm/types/spec.d.ts +1 -0
- package/esm/types/theme.d.ts +7 -7
- package/esm/util/animate.d.ts +7 -2
- package/esm/util/animate.js +37 -23
- package/esm/util/animate.js.map +1 -1
- package/esm/util/bbox.d.ts +7 -1
- package/esm/util/bbox.js +16 -0
- package/esm/util/bbox.js.map +1 -1
- package/esm/util/data.d.ts +7 -1
- package/esm/util/data.js +17 -5
- package/esm/util/data.js.map +1 -1
- package/esm/util/dom.js +5 -5
- package/esm/util/dom.js.map +1 -1
- package/esm/util/item.d.ts +1 -1
- package/esm/util/item.js +8 -8
- package/esm/util/item.js.map +1 -1
- package/esm/util/mapper.js +1 -1
- package/esm/util/mapper.js.map +1 -1
- package/esm/util/path.d.ts +6 -1
- package/esm/util/path.js +72 -1
- package/esm/util/path.js.map +1 -1
- package/esm/util/polyline.d.ts +10 -0
- package/esm/util/polyline.js +22 -17
- package/esm/util/polyline.js.map +1 -1
- package/esm/util/router.d.ts +1 -1
- package/esm/util/router.js +19 -18
- package/esm/util/router.js.map +1 -1
- package/esm/util/shape.d.ts +1 -1
- package/esm/util/shape.js +28 -13
- package/esm/util/shape.js.map +1 -1
- package/esm/util/zoom.d.ts +5 -8
- package/esm/util/zoom.js +15 -20
- package/esm/util/zoom.js.map +1 -1
- package/lib/constant/shape.d.ts +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +1 -1
- package/lib/item/combo.d.ts +6 -4
- package/lib/item/combo.js +10 -3
- package/lib/item/combo.js.map +1 -1
- package/lib/item/edge.d.ts +12 -4
- package/lib/item/edge.js +99 -16
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.d.ts +18 -8
- package/lib/item/item.js +101 -57
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +10 -4
- package/lib/item/node.js +92 -8
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/data.d.ts +5 -1
- package/lib/runtime/controller/data.js +38 -1
- package/lib/runtime/controller/data.js.map +1 -1
- package/lib/runtime/controller/index.d.ts +1 -1
- package/lib/runtime/controller/index.js +1 -1
- package/lib/runtime/controller/index.js.map +1 -1
- package/lib/runtime/controller/item.d.ts +22 -11
- package/lib/runtime/controller/item.js +238 -93
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/controller/layout.d.ts +3 -0
- package/lib/runtime/controller/layout.js +178 -98
- package/lib/runtime/controller/layout.js.map +1 -1
- package/lib/runtime/controller/plugin.d.ts +3 -0
- package/lib/runtime/controller/plugin.js +66 -24
- package/lib/runtime/controller/plugin.js.map +1 -1
- package/lib/runtime/controller/viewport.js +9 -2
- package/lib/runtime/controller/viewport.js.map +1 -1
- package/lib/runtime/graph.d.ts +57 -26
- package/lib/runtime/graph.js +263 -139
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/click-select.js +9 -3
- package/lib/stdlib/behavior/click-select.js.map +1 -1
- package/lib/stdlib/behavior/drag-canvas.js +6 -3
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
- package/lib/stdlib/behavior/drag-combo.js +8 -8
- package/lib/stdlib/behavior/drag-combo.js.map +1 -1
- package/lib/stdlib/behavior/drag-node.d.ts +4 -0
- package/lib/stdlib/behavior/drag-node.js +121 -27
- package/lib/stdlib/behavior/drag-node.js.map +1 -1
- package/lib/stdlib/behavior/scroll-canvas.js +3 -3
- package/lib/stdlib/behavior/scroll-canvas.js.map +1 -1
- package/lib/stdlib/behavior/zoom-canvas.js +3 -3
- package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/lib/stdlib/data/mapNodeSize.js +2 -2
- package/lib/stdlib/data/mapNodeSize.js.map +1 -1
- package/lib/stdlib/data/validateData.js +2 -2
- package/lib/stdlib/data/validateData.js.map +1 -1
- package/lib/stdlib/index.d.ts +2 -0
- package/lib/stdlib/index.js +3 -1
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/edge/base.d.ts +2 -11
- package/lib/stdlib/item/edge/base.js +12 -105
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/node/base.d.ts +2 -20
- package/lib/stdlib/item/node/base.js +10 -150
- package/lib/stdlib/item/node/base.js.map +1 -1
- package/lib/stdlib/plugin/edgeFilterLens/index.js +2 -2
- package/lib/stdlib/plugin/edgeFilterLens/index.js.map +1 -1
- package/lib/stdlib/plugin/fisheye/index.js +2 -1
- package/lib/stdlib/plugin/fisheye/index.js.map +1 -1
- package/lib/stdlib/plugin/history/visibility-updated-command.js +2 -2
- package/lib/stdlib/plugin/history/visibility-updated-command.js.map +1 -1
- package/lib/stdlib/plugin/hull/index.d.ts +1 -1
- package/lib/stdlib/plugin/index.d.ts +1 -0
- package/lib/stdlib/plugin/index.js +1 -0
- package/lib/stdlib/plugin/index.js.map +1 -1
- package/lib/stdlib/plugin/lodController/index.d.ts +73 -0
- package/lib/stdlib/plugin/lodController/index.js +560 -0
- package/lib/stdlib/plugin/lodController/index.js.map +1 -0
- package/lib/stdlib/plugin/minimap/index.js +12 -14
- package/lib/stdlib/plugin/minimap/index.js.map +1 -1
- package/lib/stdlib/plugin/toolbar/index.d.ts +2 -2
- package/lib/stdlib/plugin/toolbar/index.js +27 -29
- package/lib/stdlib/plugin/toolbar/index.js.map +1 -1
- package/lib/stdlib/theme/dark.js +32 -35
- package/lib/stdlib/theme/dark.js.map +1 -1
- package/lib/stdlib/theme/light.js +27 -30
- package/lib/stdlib/theme/light.js.map +1 -1
- package/lib/stdlib/themeSolver/spec.js +2 -2
- package/lib/stdlib/themeSolver/spec.js.map +1 -1
- package/lib/types/animate.d.ts +1 -1
- package/lib/types/combo.d.ts +2 -2
- package/lib/types/edge.d.ts +2 -2
- package/lib/types/graph.d.ts +62 -43
- package/lib/types/hook.d.ts +5 -0
- package/lib/types/item.d.ts +9 -15
- package/lib/types/layout.d.ts +7 -2
- package/lib/types/layout.js.map +1 -1
- package/lib/types/node.d.ts +3 -2
- package/lib/types/plugin.d.ts +1 -0
- package/lib/types/plugin.js +1 -0
- package/lib/types/plugin.js.map +1 -1
- package/lib/types/spec.d.ts +1 -0
- package/lib/types/theme.d.ts +7 -7
- package/lib/util/animate.d.ts +7 -2
- package/lib/util/animate.js +37 -23
- package/lib/util/animate.js.map +1 -1
- package/lib/util/bbox.d.ts +7 -1
- package/lib/util/bbox.js +18 -1
- package/lib/util/bbox.js.map +1 -1
- package/lib/util/data.d.ts +7 -1
- package/lib/util/data.js +19 -6
- package/lib/util/data.js.map +1 -1
- package/lib/util/dom.js +5 -5
- package/lib/util/dom.js.map +1 -1
- package/lib/util/item.d.ts +1 -1
- package/lib/util/item.js +8 -8
- package/lib/util/item.js.map +1 -1
- package/lib/util/mapper.js +1 -1
- package/lib/util/mapper.js.map +1 -1
- package/lib/util/path.d.ts +6 -1
- package/lib/util/path.js +72 -1
- package/lib/util/path.js.map +1 -1
- package/lib/util/polyline.d.ts +10 -0
- package/lib/util/polyline.js +25 -18
- package/lib/util/polyline.js.map +1 -1
- package/lib/util/router.d.ts +1 -1
- package/lib/util/router.js +19 -18
- package/lib/util/router.js.map +1 -1
- package/lib/util/shape.d.ts +1 -1
- package/lib/util/shape.js +27 -12
- package/lib/util/shape.js.map +1 -1
- package/lib/util/zoom.d.ts +5 -8
- package/lib/util/zoom.js +17 -22
- package/lib/util/zoom.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/item/combo.ts +13 -5
- package/src/item/edge.ts +126 -17
- package/src/item/item.ts +119 -57
- package/src/item/node.ts +108 -11
- package/src/runtime/controller/data.ts +64 -3
- package/src/runtime/controller/index.ts +1 -1
- package/src/runtime/controller/item.ts +321 -135
- package/src/runtime/controller/layout.ts +254 -113
- package/src/runtime/controller/plugin.ts +86 -33
- package/src/runtime/controller/viewport.ts +8 -2
- package/src/runtime/graph.ts +383 -158
- package/src/stdlib/behavior/click-select.ts +8 -3
- package/src/stdlib/behavior/drag-canvas.ts +6 -3
- package/src/stdlib/behavior/drag-combo.ts +8 -8
- package/src/stdlib/behavior/drag-node.ts +165 -50
- package/src/stdlib/behavior/scroll-canvas.ts +3 -3
- package/src/stdlib/behavior/zoom-canvas.ts +3 -3
- package/src/stdlib/data/mapNodeSize.ts +2 -2
- package/src/stdlib/data/validateData.ts +2 -2
- package/src/stdlib/index.ts +3 -0
- package/src/stdlib/item/edge/base.ts +15 -139
- package/src/stdlib/item/node/base.ts +20 -215
- package/src/stdlib/plugin/edgeFilterLens/index.ts +2 -2
- package/src/stdlib/plugin/fisheye/index.ts +3 -2
- package/src/stdlib/plugin/history/visibility-updated-command.ts +2 -2
- package/src/stdlib/plugin/index.ts +1 -0
- package/src/stdlib/plugin/lodController/index.ts +602 -0
- package/src/stdlib/plugin/minimap/index.ts +12 -14
- package/src/stdlib/plugin/toolbar/index.ts +29 -31
- package/src/stdlib/theme/dark.ts +32 -34
- package/src/stdlib/theme/light.ts +27 -29
- package/src/stdlib/themeSolver/spec.ts +2 -2
- package/src/types/animate.ts +1 -1
- package/src/types/combo.ts +2 -2
- package/src/types/edge.ts +2 -2
- package/src/types/graph.ts +65 -53
- package/src/types/hook.ts +5 -0
- package/src/types/item.ts +8 -14
- package/src/types/layout.ts +20 -15
- package/src/types/node.ts +3 -2
- package/src/types/plugin.ts +2 -0
- package/src/types/spec.ts +1 -0
- package/src/types/theme.ts +7 -7
- package/src/util/animate.ts +104 -78
- package/src/util/bbox.ts +26 -1
- package/src/util/data.ts +15 -6
- package/src/util/dom.ts +6 -6
- package/src/util/item.ts +15 -1
- package/src/util/mapper.ts +1 -1
- package/src/util/path.ts +72 -2
- package/src/util/polyline.ts +30 -23
- package/src/util/router.ts +21 -19
- package/src/util/shape.ts +27 -12
- package/src/util/zoom.ts +19 -25
- package/esm/runtime/controller/extension.d.ts +0 -9
- package/esm/runtime/controller/extension.js +0 -11
- package/esm/runtime/controller/extension.js.map +0 -1
- package/lib/runtime/controller/extension.d.ts +0 -9
- package/lib/runtime/controller/extension.js +0 -15
- package/lib/runtime/controller/extension.js.map +0 -1
- package/src/runtime/controller/extension.ts +0 -14
|
@@ -140,16 +140,21 @@ export class ClickSelect extends Behavior {
|
|
|
140
140
|
if (!multiple) {
|
|
141
141
|
// Not multiple, clear all currently selected items
|
|
142
142
|
this.graph.setItemState(this.selectedIds, state, false);
|
|
143
|
+
this.selectedIds = [];
|
|
143
144
|
}
|
|
144
|
-
if (
|
|
145
|
-
this.
|
|
145
|
+
if (isSelectAction) {
|
|
146
|
+
if (!this.selectedIds.includes(itemId)) {
|
|
147
|
+
this.graph.setItemState(itemId, state, true);
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
this.graph.setItemState(itemId, state, false);
|
|
146
151
|
}
|
|
147
152
|
});
|
|
148
153
|
|
|
149
154
|
if (isSelectAction) {
|
|
150
155
|
this.selectedIds.push(itemId);
|
|
151
156
|
} else {
|
|
152
|
-
this.selectedIds.filter((id) => id !== itemId);
|
|
157
|
+
this.selectedIds = this.selectedIds.filter((id) => id !== itemId);
|
|
153
158
|
}
|
|
154
159
|
}
|
|
155
160
|
|
|
@@ -55,7 +55,7 @@ export interface DragCanvasOptions {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
const DEFAULT_OPTIONS: Required<DragCanvasOptions> = {
|
|
58
|
-
enableOptimize:
|
|
58
|
+
enableOptimize: false,
|
|
59
59
|
dragOnItems: false,
|
|
60
60
|
trigger: 'drag',
|
|
61
61
|
direction: 'both',
|
|
@@ -172,7 +172,10 @@ export class DragCanvas extends Behavior {
|
|
|
172
172
|
}
|
|
173
173
|
const section = sections.shift();
|
|
174
174
|
graph.executeWithNoStack(() => {
|
|
175
|
-
graph.hideItem(section,
|
|
175
|
+
graph.hideItem(section, {
|
|
176
|
+
disableAnimate: false,
|
|
177
|
+
keepKeyShape: true,
|
|
178
|
+
});
|
|
176
179
|
});
|
|
177
180
|
this.tileRequestId = requestAnimationFrame(update);
|
|
178
181
|
};
|
|
@@ -320,7 +323,7 @@ export class DragCanvas extends Behavior {
|
|
|
320
323
|
return;
|
|
321
324
|
}
|
|
322
325
|
graph.startHistoryBatch();
|
|
323
|
-
graph.showItem(sections.shift(), false);
|
|
326
|
+
graph.showItem(sections.shift(), { disableAnimate: false });
|
|
324
327
|
graph.stopHistoryBatch();
|
|
325
328
|
this.tileRequestId = requestAnimationFrame(update);
|
|
326
329
|
};
|
|
@@ -253,11 +253,11 @@ export class DragCombo extends Behavior {
|
|
|
253
253
|
this.graph.executeWithNoStack(() => {
|
|
254
254
|
this.graph.hideItem(
|
|
255
255
|
this.hiddenEdges.map((edge) => edge.id),
|
|
256
|
-
true,
|
|
256
|
+
{ disableAnimate: true },
|
|
257
257
|
);
|
|
258
258
|
this.graph.hideItem(
|
|
259
259
|
this.hiddenComboTreeRoots.map((child) => child.id),
|
|
260
|
-
true,
|
|
260
|
+
{ disableAnimate: true },
|
|
261
261
|
);
|
|
262
262
|
});
|
|
263
263
|
}
|
|
@@ -281,14 +281,14 @@ export class DragCombo extends Behavior {
|
|
|
281
281
|
|
|
282
282
|
// Hide original edges and nodes. They will be restored when pointerup.
|
|
283
283
|
this.graph.executeWithNoStack(() => {
|
|
284
|
-
this.graph.hideItem(selectedComboIds, true);
|
|
284
|
+
this.graph.hideItem(selectedComboIds, { disableAnimate: true });
|
|
285
285
|
this.graph.hideItem(
|
|
286
286
|
this.hiddenEdges.map((edge) => edge.id),
|
|
287
|
-
true,
|
|
287
|
+
{ disableAnimate: true },
|
|
288
288
|
);
|
|
289
289
|
this.graph.hideItem(
|
|
290
290
|
this.hiddenComboTreeRoots.map((child) => child.id),
|
|
291
|
-
true,
|
|
291
|
+
{ disableAnimate: true },
|
|
292
292
|
);
|
|
293
293
|
});
|
|
294
294
|
} else {
|
|
@@ -433,14 +433,14 @@ export class DragCombo extends Behavior {
|
|
|
433
433
|
if (this.hiddenEdges.length) {
|
|
434
434
|
this.graph.showItem(
|
|
435
435
|
this.hiddenEdges.map((edge) => edge.id),
|
|
436
|
-
true,
|
|
436
|
+
{ disableAnimate: true },
|
|
437
437
|
);
|
|
438
438
|
this.hiddenEdges = [];
|
|
439
439
|
}
|
|
440
440
|
if (this.hiddenComboTreeRoots.length) {
|
|
441
441
|
this.graph.showItem(
|
|
442
442
|
this.hiddenComboTreeRoots.map((model) => model.id),
|
|
443
|
-
true,
|
|
443
|
+
{ disableAnimate: true },
|
|
444
444
|
);
|
|
445
445
|
this.hiddenComboTreeRoots = [];
|
|
446
446
|
}
|
|
@@ -449,7 +449,7 @@ export class DragCombo extends Behavior {
|
|
|
449
449
|
if (enableTransient) {
|
|
450
450
|
this.graph.showItem(
|
|
451
451
|
this.originPositions.concat(positions).map((position) => position.id),
|
|
452
|
-
true,
|
|
452
|
+
{ disableAnimate: true },
|
|
453
453
|
);
|
|
454
454
|
}
|
|
455
455
|
this.graph.resumeStack();
|
|
@@ -5,6 +5,10 @@ import { Behavior } from '../../types/behavior';
|
|
|
5
5
|
import { IG6GraphEvent } from '../../types/event';
|
|
6
6
|
import { Point } from '../../types/common';
|
|
7
7
|
import { graphComboTreeDfs } from '../../util/data';
|
|
8
|
+
import {
|
|
9
|
+
isPointPreventPolylineOverlap,
|
|
10
|
+
isPolylineWithObstacleAvoidance,
|
|
11
|
+
} from '../../util/polyline';
|
|
8
12
|
|
|
9
13
|
const DELEGATE_SHAPE_ID = 'g6-drag-node-delegate-shape';
|
|
10
14
|
|
|
@@ -100,6 +104,7 @@ type Position = {
|
|
|
100
104
|
export class DragNode extends Behavior {
|
|
101
105
|
// Private states
|
|
102
106
|
private hiddenEdges: EdgeModel[] = [];
|
|
107
|
+
private hiddenRelatedNodes: NodeModel[] = [];
|
|
103
108
|
private selectedNodeIds: ID[] = [];
|
|
104
109
|
private hiddenNearEdges: EdgeModel[] = [];
|
|
105
110
|
private hiddenComboTreeItems: (ComboModel | NodeModel)[] = [];
|
|
@@ -108,6 +113,8 @@ export class DragNode extends Behavior {
|
|
|
108
113
|
private originPositions: Array<Position> = [];
|
|
109
114
|
private pointerDown: Point | undefined = undefined;
|
|
110
115
|
private dragging = false;
|
|
116
|
+
private hiddenNearEdgesCache: EdgeModel[] = [];
|
|
117
|
+
private hiddenShapeCache: Map<ID, string[]> = new Map();
|
|
111
118
|
|
|
112
119
|
constructor(options: Partial<DragNodeOptions>) {
|
|
113
120
|
const finalOptions = Object.assign({}, DEFAULT_OPTIONS, options);
|
|
@@ -148,31 +155,39 @@ export class DragNode extends Behavior {
|
|
|
148
155
|
private getRelatedEdges(
|
|
149
156
|
selectedNodeIds: ID[],
|
|
150
157
|
relatedCombo: (ComboModel | NodeModel)[],
|
|
151
|
-
onlyVisible = true,
|
|
152
158
|
) {
|
|
153
159
|
const relatedNodeComboIds = [];
|
|
154
160
|
graphComboTreeDfs(this.graph, relatedCombo, (item) =>
|
|
155
161
|
relatedNodeComboIds.push(item.id),
|
|
156
162
|
);
|
|
157
163
|
|
|
158
|
-
|
|
164
|
+
return uniq(
|
|
159
165
|
selectedNodeIds
|
|
160
166
|
.concat(relatedNodeComboIds)
|
|
161
167
|
.flatMap((nodeId) => this.graph.getRelatedEdgesData(nodeId)),
|
|
162
168
|
);
|
|
169
|
+
}
|
|
163
170
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
171
|
+
private getRelatedNodes(selectedNodeIds: ID[]) {
|
|
172
|
+
let relatedNodes = [];
|
|
173
|
+
selectedNodeIds.forEach((id) => {
|
|
174
|
+
const neighbors = this.graph
|
|
175
|
+
.getNeighborNodesData(id, 'both')
|
|
176
|
+
.filter((neighbor) => !selectedNodeIds.includes(neighbor.id));
|
|
177
|
+
relatedNodes = relatedNodes.concat(neighbors);
|
|
178
|
+
});
|
|
179
|
+
return relatedNodes;
|
|
170
180
|
}
|
|
171
181
|
|
|
172
182
|
/** Retrieve the nearby edges for a given node using quadtree collision detection. */
|
|
173
|
-
private getNearEdgesForNodes(
|
|
183
|
+
private getNearEdgesForNodes(
|
|
184
|
+
nodeIds: ID[],
|
|
185
|
+
shouldBegin?: (edge: EdgeModel) => boolean,
|
|
186
|
+
) {
|
|
174
187
|
return uniq(
|
|
175
|
-
nodeIds.flatMap((nodeId) =>
|
|
188
|
+
nodeIds.flatMap((nodeId) =>
|
|
189
|
+
this.graph.getNearEdgesData(nodeId, shouldBegin),
|
|
190
|
+
),
|
|
176
191
|
);
|
|
177
192
|
}
|
|
178
193
|
|
|
@@ -267,14 +282,45 @@ export class DragNode extends Behavior {
|
|
|
267
282
|
this.selectedNodeIds,
|
|
268
283
|
this.hiddenComboTreeItems,
|
|
269
284
|
);
|
|
285
|
+
this.hiddenRelatedNodes = this.getRelatedNodes(this.selectedNodeIds);
|
|
270
286
|
this.graph.executeWithNoStack(() => {
|
|
271
|
-
this.
|
|
272
|
-
|
|
273
|
-
|
|
287
|
+
const hiddenEdgeIds = this.hiddenEdges.map((edge) => edge.id);
|
|
288
|
+
hiddenEdgeIds.forEach((edgeId) => {
|
|
289
|
+
this.hiddenShapeCache.set(
|
|
290
|
+
edgeId,
|
|
291
|
+
this.graph.getItemVisibleShapeIds(edgeId),
|
|
292
|
+
);
|
|
293
|
+
});
|
|
294
|
+
this.graph.hideItem(hiddenEdgeIds, {
|
|
295
|
+
disableAnimate: true,
|
|
296
|
+
});
|
|
297
|
+
const hiddenRelatedNodeIds = this.hiddenRelatedNodes.map(
|
|
298
|
+
(node) => node.id,
|
|
299
|
+
);
|
|
300
|
+
hiddenRelatedNodeIds.forEach((nodeId) => {
|
|
301
|
+
this.hiddenShapeCache.set(
|
|
302
|
+
nodeId,
|
|
303
|
+
this.graph.getItemVisibleShapeIds(nodeId),
|
|
304
|
+
);
|
|
305
|
+
});
|
|
306
|
+
this.graph.hideItem(hiddenRelatedNodeIds, {
|
|
307
|
+
disableAnimate: true,
|
|
308
|
+
keepRelated: true,
|
|
309
|
+
});
|
|
310
|
+
const hiddenComboTreeItemIds = this.hiddenComboTreeItems.map(
|
|
311
|
+
(child) => child.id,
|
|
274
312
|
);
|
|
313
|
+
hiddenComboTreeItemIds.forEach((itemId) => {
|
|
314
|
+
this.hiddenShapeCache.set(
|
|
315
|
+
itemId,
|
|
316
|
+
this.graph.getItemVisibleShapeIds(itemId),
|
|
317
|
+
);
|
|
318
|
+
});
|
|
275
319
|
this.graph.hideItem(
|
|
276
320
|
this.hiddenComboTreeItems.map((child) => child.id),
|
|
277
|
-
|
|
321
|
+
{
|
|
322
|
+
disableAnimate: true,
|
|
323
|
+
},
|
|
278
324
|
);
|
|
279
325
|
});
|
|
280
326
|
}
|
|
@@ -290,6 +336,7 @@ export class DragNode extends Behavior {
|
|
|
290
336
|
this.selectedNodeIds,
|
|
291
337
|
this.hiddenComboTreeItems,
|
|
292
338
|
);
|
|
339
|
+
this.hiddenRelatedNodes = this.getRelatedNodes(this.selectedNodeIds);
|
|
293
340
|
this.selectedNodeIds.forEach((nodeId) => {
|
|
294
341
|
// draw the nodes' transients and their ancestor combos' transisents
|
|
295
342
|
this.graph.drawTransient('node', nodeId, {
|
|
@@ -302,14 +349,47 @@ export class DragNode extends Behavior {
|
|
|
302
349
|
|
|
303
350
|
// Hide original edges and nodes. They will be restored when pointerup.
|
|
304
351
|
this.graph.executeWithNoStack(() => {
|
|
305
|
-
this.
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
352
|
+
this.selectedNodeIds.forEach((itemId) => {
|
|
353
|
+
this.hiddenShapeCache.set(
|
|
354
|
+
itemId,
|
|
355
|
+
this.graph.getItemVisibleShapeIds(itemId),
|
|
356
|
+
);
|
|
357
|
+
});
|
|
358
|
+
this.graph.hideItem(this.selectedNodeIds, { disableAnimate: true });
|
|
359
|
+
|
|
360
|
+
const hiddenEdgeIds = this.hiddenEdges.map((edge) => edge.id);
|
|
361
|
+
hiddenEdgeIds.forEach((itemId) => {
|
|
362
|
+
this.hiddenShapeCache.set(
|
|
363
|
+
itemId,
|
|
364
|
+
this.graph.getItemVisibleShapeIds(itemId),
|
|
365
|
+
);
|
|
366
|
+
});
|
|
367
|
+
this.graph.hideItem(hiddenEdgeIds, { disableAnimate: true });
|
|
368
|
+
const hiddenRelatedNodeIds = this.hiddenRelatedNodes.map(
|
|
369
|
+
(node) => node.id,
|
|
370
|
+
);
|
|
371
|
+
hiddenRelatedNodeIds.forEach((itemId) => {
|
|
372
|
+
this.hiddenShapeCache.set(
|
|
373
|
+
itemId,
|
|
374
|
+
this.graph.getItemVisibleShapeIds(itemId),
|
|
375
|
+
);
|
|
376
|
+
});
|
|
377
|
+
this.graph.hideItem(hiddenRelatedNodeIds, {
|
|
378
|
+
disableAnimate: true,
|
|
379
|
+
keepRelated: true,
|
|
380
|
+
});
|
|
381
|
+
const hiddenComboTreeItemIds = this.hiddenComboTreeItems.map(
|
|
382
|
+
(combo) => combo.id,
|
|
309
383
|
);
|
|
384
|
+
hiddenComboTreeItemIds.forEach((itemId) => {
|
|
385
|
+
this.hiddenShapeCache.set(
|
|
386
|
+
itemId,
|
|
387
|
+
this.graph.getItemVisibleShapeIds(itemId),
|
|
388
|
+
);
|
|
389
|
+
});
|
|
310
390
|
this.graph.hideItem(
|
|
311
391
|
this.hiddenComboTreeItems.map((combo) => combo.id),
|
|
312
|
-
true,
|
|
392
|
+
{ disableAnimate: true },
|
|
313
393
|
);
|
|
314
394
|
});
|
|
315
395
|
} else {
|
|
@@ -332,32 +412,48 @@ export class DragNode extends Behavior {
|
|
|
332
412
|
}
|
|
333
413
|
|
|
334
414
|
/**
|
|
335
|
-
* When dragging nodes, if nodes are set to `preventPolylineEdgeOverlap`,
|
|
336
|
-
* use quadtree collision detection to identity nearby edges and dynamically update them
|
|
415
|
+
* When dragging nodes, if nodes are set to `preventPolylineEdgeOverlap`, identity nearby edges and dynamically update them
|
|
337
416
|
*/
|
|
338
417
|
if (this.dragging && enableTransient) {
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
this.graph.getNodeData(nodeId)
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
418
|
+
const preventPolylineOverlapNodeIds = this.selectedNodeIds.filter(
|
|
419
|
+
(nodeId) => {
|
|
420
|
+
const innerModel = this.graph.getNodeData(nodeId);
|
|
421
|
+
return isPointPreventPolylineOverlap(innerModel);
|
|
422
|
+
},
|
|
423
|
+
);
|
|
345
424
|
|
|
346
|
-
if (
|
|
425
|
+
if (preventPolylineOverlapNodeIds.length) {
|
|
347
426
|
const hiddenEdgesIds = this.hiddenEdges.map((edge) => edge.id);
|
|
427
|
+
this.hiddenNearEdgesCache = this.hiddenNearEdges;
|
|
428
|
+
|
|
348
429
|
this.hiddenNearEdges = this.getNearEdgesForNodes(
|
|
349
|
-
|
|
430
|
+
preventPolylineOverlapNodeIds,
|
|
431
|
+
(edge) => isPolylineWithObstacleAvoidance(edge),
|
|
350
432
|
).filter((edge) => !hiddenEdgesIds.includes(edge.id));
|
|
433
|
+
const hiddenNearEdgesIds = this.hiddenNearEdges.map((edge) => edge.id);
|
|
434
|
+
|
|
435
|
+
this.hiddenNearEdgesCache.forEach((edge) => {
|
|
436
|
+
if (!hiddenNearEdgesIds.includes(edge.id)) {
|
|
437
|
+
this.graph.drawTransient('edge', edge.id, { action: 'remove' });
|
|
438
|
+
this.graph.showItem(edge.id);
|
|
439
|
+
}
|
|
440
|
+
});
|
|
351
441
|
|
|
352
442
|
if (this.hiddenNearEdges.length) {
|
|
353
443
|
this.hiddenNearEdges.forEach((edge) => {
|
|
354
|
-
this.graph.drawTransient('edge', edge.id, {
|
|
444
|
+
this.graph.drawTransient('edge', edge.id, {
|
|
445
|
+
visible: true,
|
|
446
|
+
});
|
|
355
447
|
});
|
|
356
448
|
|
|
357
|
-
this.
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
449
|
+
const hiddenNearEdgeIds = this.hiddenNearEdges.map((edge) => edge.id);
|
|
450
|
+
hiddenNearEdgeIds.forEach((itemId) => {
|
|
451
|
+
this.hiddenShapeCache.set(
|
|
452
|
+
itemId,
|
|
453
|
+
this.graph.getItemVisibleShapeIds(itemId),
|
|
454
|
+
);
|
|
455
|
+
});
|
|
456
|
+
this.graph.hideItem(hiddenNearEdgeIds, { disableAnimate: true });
|
|
361
457
|
}
|
|
362
458
|
}
|
|
363
459
|
}
|
|
@@ -489,33 +585,52 @@ export class DragNode extends Behavior {
|
|
|
489
585
|
public restoreHiddenItems(positions?: Position[]) {
|
|
490
586
|
this.graph.pauseStack();
|
|
491
587
|
if (this.hiddenEdges.length) {
|
|
492
|
-
this.
|
|
493
|
-
this.
|
|
494
|
-
|
|
495
|
-
|
|
588
|
+
this.hiddenEdges.forEach((edge) => {
|
|
589
|
+
this.graph.showItem(edge.id, {
|
|
590
|
+
disableAnimate: true,
|
|
591
|
+
shapeIds: this.hiddenShapeCache.get(edge.id),
|
|
592
|
+
});
|
|
593
|
+
this.hiddenShapeCache.delete(edge.id);
|
|
594
|
+
});
|
|
496
595
|
this.hiddenEdges = [];
|
|
497
596
|
}
|
|
597
|
+
if (this.hiddenRelatedNodes.length) {
|
|
598
|
+
this.hiddenRelatedNodes.forEach((node) => {
|
|
599
|
+
this.graph.showItem(node.id, {
|
|
600
|
+
disableAnimate: true,
|
|
601
|
+
shapeIds: this.hiddenShapeCache.get(node.id),
|
|
602
|
+
});
|
|
603
|
+
this.hiddenShapeCache.delete(node.id);
|
|
604
|
+
});
|
|
605
|
+
this.hiddenRelatedNodes = [];
|
|
606
|
+
}
|
|
498
607
|
if (this.hiddenNearEdges.length) {
|
|
499
|
-
this.
|
|
500
|
-
this.
|
|
501
|
-
|
|
502
|
-
);
|
|
608
|
+
this.hiddenNearEdges.forEach((edge) => {
|
|
609
|
+
this.graph.showItem(edge.id, { disableAnimate: true });
|
|
610
|
+
this.hiddenShapeCache.delete(edge.id);
|
|
611
|
+
});
|
|
503
612
|
this.hiddenNearEdges = [];
|
|
504
613
|
}
|
|
505
614
|
if (this.hiddenComboTreeItems.length) {
|
|
506
|
-
this.
|
|
507
|
-
this.
|
|
508
|
-
|
|
509
|
-
|
|
615
|
+
this.hiddenComboTreeItems.forEach((edge) => {
|
|
616
|
+
this.graph.showItem(edge.id, {
|
|
617
|
+
disableAnimate: true,
|
|
618
|
+
shapeIds: this.hiddenShapeCache.get(edge.id),
|
|
619
|
+
});
|
|
620
|
+
this.hiddenShapeCache.delete(edge.id);
|
|
621
|
+
});
|
|
510
622
|
this.hiddenComboTreeItems = [];
|
|
511
623
|
}
|
|
512
624
|
const enableTransient =
|
|
513
625
|
this.options.enableTransient && this.graph.rendererType !== 'webgl-3d';
|
|
514
626
|
if (enableTransient) {
|
|
515
|
-
this.
|
|
516
|
-
this.
|
|
517
|
-
|
|
518
|
-
|
|
627
|
+
this.originPositions.concat(positions).forEach((pos) => {
|
|
628
|
+
this.graph.showItem(pos.id, {
|
|
629
|
+
disableAnimate: true,
|
|
630
|
+
shapeIds: this.hiddenShapeCache.get(pos.id),
|
|
631
|
+
});
|
|
632
|
+
this.hiddenShapeCache.delete(pos.id);
|
|
633
|
+
});
|
|
519
634
|
}
|
|
520
635
|
this.graph.resumeStack();
|
|
521
636
|
}
|
|
@@ -231,7 +231,7 @@ export class ScrollCanvas extends Behavior {
|
|
|
231
231
|
.getAllEdgesData()
|
|
232
232
|
.map((edge) => edge.id)
|
|
233
233
|
.filter((id) => graph.getItemVisible(id));
|
|
234
|
-
graph.hideItem(newHiddenEdgeIds, true);
|
|
234
|
+
graph.hideItem(newHiddenEdgeIds, { disableAnimate: true });
|
|
235
235
|
|
|
236
236
|
if (currentZoom < optimizeZoom) {
|
|
237
237
|
this.hiddenEdgeIds.push(...newHiddenEdgeIds);
|
|
@@ -259,7 +259,7 @@ export class ScrollCanvas extends Behavior {
|
|
|
259
259
|
}
|
|
260
260
|
const section = sections.shift();
|
|
261
261
|
graph.startHistoryBatch();
|
|
262
|
-
graph.hideItem(section, false, true);
|
|
262
|
+
graph.hideItem(section, { disableAnimate: false, keepKeyShape: true });
|
|
263
263
|
graph.stopHistoryBatch();
|
|
264
264
|
requestId = requestAnimationFrame(update);
|
|
265
265
|
};
|
|
@@ -309,7 +309,7 @@ export class ScrollCanvas extends Behavior {
|
|
|
309
309
|
return;
|
|
310
310
|
}
|
|
311
311
|
graph.executeWithNoStack(() => {
|
|
312
|
-
graph.showItem(sections.shift(), false);
|
|
312
|
+
graph.showItem(sections.shift(), { disableAnimate: false });
|
|
313
313
|
});
|
|
314
314
|
requestId = requestAnimationFrame(update);
|
|
315
315
|
};
|
|
@@ -58,7 +58,7 @@ export interface ZoomCanvasOptions {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
const DEFAULT_OPTIONS: Required<ZoomCanvasOptions> = {
|
|
61
|
-
enableOptimize:
|
|
61
|
+
enableOptimize: false,
|
|
62
62
|
triggerOnItems: true,
|
|
63
63
|
sensitivity: 6,
|
|
64
64
|
trigger: 'wheel',
|
|
@@ -153,7 +153,7 @@ export class ZoomCanvas extends Behavior {
|
|
|
153
153
|
}
|
|
154
154
|
const section = sections.shift();
|
|
155
155
|
graph.startHistoryBatch();
|
|
156
|
-
graph.hideItem(section, false, true);
|
|
156
|
+
graph.hideItem(section, { disableAnimate: false, keepKeyShape: true });
|
|
157
157
|
graph.stopHistoryBatch();
|
|
158
158
|
this.tileRequestId = requestAnimationFrame(update);
|
|
159
159
|
};
|
|
@@ -194,7 +194,7 @@ export class ZoomCanvas extends Behavior {
|
|
|
194
194
|
return;
|
|
195
195
|
}
|
|
196
196
|
graph.executeWithNoStack(() => {
|
|
197
|
-
graph.showItem(sections.shift(), false);
|
|
197
|
+
graph.showItem(sections.shift(), { disableAnimate: false });
|
|
198
198
|
});
|
|
199
199
|
this.tileRequestId = requestAnimationFrame(update);
|
|
200
200
|
};
|
|
@@ -58,11 +58,11 @@ const handler = (
|
|
|
58
58
|
const sizeMap = scaleNodeProp(nodes, field, valueRange, range);
|
|
59
59
|
sizeMap.forEach((val, id) => {
|
|
60
60
|
let value = val;
|
|
61
|
-
if (isNaN(val)) value = range[0];
|
|
61
|
+
if (isNaN(val) || !val) value = range[0];
|
|
62
62
|
const node = nodeMap.get(id);
|
|
63
63
|
node.data.keyShape = {
|
|
64
64
|
...node.data.keyShape,
|
|
65
|
-
r: value / 2,
|
|
65
|
+
r: Math.round(value / 2),
|
|
66
66
|
width: value,
|
|
67
67
|
height: value,
|
|
68
68
|
};
|
|
@@ -22,8 +22,8 @@ export const ValidateData = (
|
|
|
22
22
|
const { dataAdded, dataRemoved, dataUpdated } = data;
|
|
23
23
|
return {
|
|
24
24
|
dataAdded: handler(dataAdded, options, graphCore),
|
|
25
|
-
dataRemoved:
|
|
26
|
-
dataUpdated:
|
|
25
|
+
dataRemoved: dataRemoved,
|
|
26
|
+
dataUpdated: dataUpdated,
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
|
package/src/stdlib/index.ts
CHANGED
|
@@ -81,6 +81,7 @@ const {
|
|
|
81
81
|
Timebar,
|
|
82
82
|
Snapline,
|
|
83
83
|
EdgeFilterLens,
|
|
84
|
+
LodController,
|
|
84
85
|
} = Plugins;
|
|
85
86
|
|
|
86
87
|
const {
|
|
@@ -135,6 +136,7 @@ const stdLib = {
|
|
|
135
136
|
},
|
|
136
137
|
plugins: {
|
|
137
138
|
history: History,
|
|
139
|
+
'lod-controller': LodController,
|
|
138
140
|
},
|
|
139
141
|
nodes: {
|
|
140
142
|
'circle-node': CircleNode,
|
|
@@ -288,6 +290,7 @@ const Extensions = {
|
|
|
288
290
|
// plugins
|
|
289
291
|
BasePlugin,
|
|
290
292
|
History,
|
|
293
|
+
LodController,
|
|
291
294
|
Toolbar,
|
|
292
295
|
Tooltip,
|
|
293
296
|
Minimap,
|