@antv/g6 5.0.0-beta.10 → 5.0.0-beta.12
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/api-doc/graph.d.ts +3 -3
- package/esm/api-doc/graph.js +3 -3
- package/esm/api-doc/graph.js.map +1 -1
- package/esm/constant/shape.d.ts +1 -1
- package/esm/index.d.ts +12 -62
- package/esm/index.js +4 -5
- package/esm/index.js.map +1 -1
- package/esm/item/node.js +0 -1
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/item.js +15 -6
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/controller/layout.js +1 -3
- package/esm/runtime/controller/layout.js.map +1 -1
- package/esm/runtime/graph.d.ts +1 -1
- package/esm/runtime/graph.js +11 -5
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/drag-canvas.d.ts +1 -1
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
- package/esm/stdlib/behavior/shortcuts-call.d.ts +2 -2
- package/esm/stdlib/behavior/shortcuts-call.js +12 -5
- package/esm/stdlib/behavior/shortcuts-call.js.map +1 -1
- package/esm/stdlib/behavior/zoom-canvas-3d.js +4 -1
- package/esm/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/esm/stdlib/index.d.ts +6 -1
- package/esm/stdlib/index.js +8 -3
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/edge/base.js +5 -1
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/edge/cubic-horizontal.js.map +1 -1
- package/esm/stdlib/item/edge/cubic-vertical.js.map +1 -1
- package/esm/stdlib/item/edge/cubic.js +1 -1
- package/esm/stdlib/item/edge/cubic.js.map +1 -1
- package/esm/stdlib/item/edge/loop.js +1 -1
- package/esm/stdlib/item/edge/loop.js.map +1 -1
- package/esm/stdlib/item/node/cube.d.ts +35 -0
- package/esm/stdlib/item/node/cube.js +54 -0
- package/esm/stdlib/item/node/cube.js.map +1 -0
- package/esm/stdlib/item/node/index.d.ts +3 -0
- package/esm/stdlib/item/node/index.js +3 -0
- package/esm/stdlib/item/node/index.js.map +1 -1
- package/esm/stdlib/plugin/edgeFilterLens/index.d.ts +66 -0
- package/esm/stdlib/plugin/edgeFilterLens/index.js +309 -0
- package/esm/stdlib/plugin/edgeFilterLens/index.js.map +1 -0
- package/esm/stdlib/plugin/grid/index.d.ts +1 -1
- package/esm/stdlib/plugin/grid/index.js +3 -4
- package/esm/stdlib/plugin/grid/index.js.map +1 -1
- package/esm/stdlib/plugin/hull/convexHull.d.ts +1 -1
- package/esm/stdlib/plugin/hull/hullComponent.js +2 -3
- package/esm/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/esm/stdlib/plugin/hull/util.d.ts +2 -2
- package/esm/stdlib/plugin/hull/util.js +6 -2
- package/esm/stdlib/plugin/hull/util.js.map +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/legend/index.d.ts +2 -2
- package/esm/stdlib/plugin/legend/index.js +3 -3
- package/esm/stdlib/plugin/legend/index.js.map +1 -1
- package/esm/stdlib/plugin/map/index.d.ts +1 -1
- package/esm/stdlib/plugin/map/index.js +4 -4
- package/esm/stdlib/plugin/map/index.js.map +1 -1
- package/esm/stdlib/plugin/menu/index.d.ts +4 -4
- package/esm/stdlib/plugin/menu/index.js +3 -3
- package/esm/stdlib/plugin/menu/index.js.map +1 -1
- package/esm/stdlib/plugin/minimap/index.d.ts +1 -1
- package/esm/stdlib/plugin/minimap/index.js +3 -3
- package/esm/stdlib/plugin/minimap/index.js.map +1 -1
- package/esm/stdlib/plugin/timebar/index.js +2 -2
- package/esm/stdlib/plugin/timebar/index.js.map +1 -1
- package/esm/stdlib/plugin/toolbar/index.d.ts +3 -3
- package/esm/stdlib/plugin/toolbar/index.js +4 -4
- package/esm/stdlib/plugin/toolbar/index.js.map +1 -1
- package/esm/stdlib/plugin/tooltip/index.d.ts +4 -4
- package/esm/stdlib/plugin/tooltip/index.js +3 -4
- package/esm/stdlib/plugin/tooltip/index.js.map +1 -1
- package/esm/stdlib/plugin/types.d.ts +1 -0
- package/esm/stdlib/plugin/watermaker/index.d.ts +78 -0
- package/esm/stdlib/plugin/watermaker/index.js +243 -0
- package/esm/stdlib/plugin/watermaker/index.js.map +1 -0
- package/esm/types/plugin.d.ts +1 -1
- package/esm/util/bbox.js +4 -5
- package/esm/util/bbox.js.map +1 -1
- package/esm/util/behavior.d.ts +2 -2
- package/esm/util/behavior.js +2 -2
- package/esm/util/behavior.js.map +1 -1
- package/esm/util/data.d.ts +2 -2
- package/esm/util/data.js.map +1 -1
- package/esm/util/dom.d.ts +15 -0
- package/esm/util/dom.js +29 -0
- package/esm/util/dom.js.map +1 -0
- package/esm/util/extend.d.ts +1 -1
- package/esm/util/extend.js +0 -1
- package/esm/util/extend.js.map +1 -1
- package/esm/util/index.d.ts +7 -52
- package/esm/util/index.js +7 -23
- package/esm/util/index.js.map +1 -1
- package/esm/util/layout.d.ts +1 -1
- package/esm/util/layout.js.map +1 -1
- package/esm/util/loop.d.ts +1 -1
- package/esm/util/math.d.ts +1 -1
- package/esm/util/matrix.d.ts +6 -0
- package/esm/util/matrix.js +48 -0
- package/esm/util/matrix.js.map +1 -0
- package/esm/util/path.js +1 -1
- package/esm/util/path.js.map +1 -1
- package/esm/util/point.d.ts +1 -1
- package/esm/util/polyline.d.ts +2 -1
- package/esm/util/polyline.js +2 -1
- package/esm/util/polyline.js.map +1 -1
- package/esm/util/router.d.ts +1 -1
- package/esm/util/shape.js.map +1 -1
- package/esm/util/shape3d.js +1 -1
- package/esm/util/shape3d.js.map +1 -1
- package/lib/api-doc/graph.d.ts +3 -3
- package/lib/api-doc/graph.js +27 -7
- package/lib/api-doc/graph.js.map +1 -1
- package/lib/constant/shape.d.ts +1 -1
- package/lib/index.d.ts +12 -62
- package/lib/index.js +18 -10
- package/lib/index.js.map +1 -1
- package/lib/item/node.js +0 -1
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/item.js +15 -6
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/controller/layout.js +1 -3
- package/lib/runtime/controller/layout.js.map +1 -1
- package/lib/runtime/graph.d.ts +1 -1
- package/lib/runtime/graph.js +12 -5
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/drag-canvas.d.ts +1 -1
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
- package/lib/stdlib/behavior/shortcuts-call.d.ts +2 -2
- package/lib/stdlib/behavior/shortcuts-call.js +12 -5
- package/lib/stdlib/behavior/shortcuts-call.js.map +1 -1
- package/lib/stdlib/behavior/zoom-canvas-3d.js +4 -1
- package/lib/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/lib/stdlib/index.d.ts +6 -1
- package/lib/stdlib/index.js +8 -3
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/edge/base.js +5 -1
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/edge/cubic-horizontal.js.map +1 -1
- package/lib/stdlib/item/edge/cubic-vertical.js.map +1 -1
- package/lib/stdlib/item/edge/cubic.js +2 -2
- package/lib/stdlib/item/edge/cubic.js.map +1 -1
- package/lib/stdlib/item/edge/loop.js +3 -3
- package/lib/stdlib/item/edge/loop.js.map +1 -1
- package/lib/stdlib/item/node/cube.d.ts +35 -0
- package/lib/stdlib/item/node/cube.js +58 -0
- package/lib/stdlib/item/node/cube.js.map +1 -0
- package/lib/stdlib/item/node/index.d.ts +3 -0
- package/lib/stdlib/item/node/index.js +3 -0
- package/lib/stdlib/item/node/index.js.map +1 -1
- package/lib/stdlib/plugin/edgeFilterLens/index.d.ts +66 -0
- package/lib/stdlib/plugin/edgeFilterLens/index.js +313 -0
- package/lib/stdlib/plugin/edgeFilterLens/index.js.map +1 -0
- package/lib/stdlib/plugin/grid/index.d.ts +1 -1
- package/lib/stdlib/plugin/grid/index.js +6 -7
- package/lib/stdlib/plugin/grid/index.js.map +1 -1
- package/lib/stdlib/plugin/hull/convexHull.d.ts +1 -1
- package/lib/stdlib/plugin/hull/hullComponent.js +2 -3
- package/lib/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/lib/stdlib/plugin/hull/util.d.ts +2 -2
- package/lib/stdlib/plugin/hull/util.js +26 -22
- package/lib/stdlib/plugin/hull/util.js.map +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/legend/index.d.ts +2 -2
- package/lib/stdlib/plugin/legend/index.js +3 -3
- package/lib/stdlib/plugin/legend/index.js.map +1 -1
- package/lib/stdlib/plugin/map/index.d.ts +1 -1
- package/lib/stdlib/plugin/map/index.js +6 -6
- package/lib/stdlib/plugin/map/index.js.map +1 -1
- package/lib/stdlib/plugin/menu/index.d.ts +4 -4
- package/lib/stdlib/plugin/menu/index.js +6 -6
- package/lib/stdlib/plugin/menu/index.js.map +1 -1
- package/lib/stdlib/plugin/minimap/index.d.ts +1 -1
- package/lib/stdlib/plugin/minimap/index.js +6 -6
- package/lib/stdlib/plugin/minimap/index.js.map +1 -1
- package/lib/stdlib/plugin/timebar/index.js +2 -2
- package/lib/stdlib/plugin/timebar/index.js.map +1 -1
- package/lib/stdlib/plugin/toolbar/index.d.ts +3 -3
- package/lib/stdlib/plugin/toolbar/index.js +5 -5
- package/lib/stdlib/plugin/toolbar/index.js.map +1 -1
- package/lib/stdlib/plugin/tooltip/index.d.ts +4 -4
- package/lib/stdlib/plugin/tooltip/index.js +10 -11
- package/lib/stdlib/plugin/tooltip/index.js.map +1 -1
- package/lib/stdlib/plugin/types.d.ts +1 -0
- package/lib/stdlib/plugin/watermaker/index.d.ts +78 -0
- package/lib/stdlib/plugin/watermaker/index.js +247 -0
- package/lib/stdlib/plugin/watermaker/index.js.map +1 -0
- package/lib/types/plugin.d.ts +1 -1
- package/lib/util/bbox.js +4 -5
- package/lib/util/bbox.js.map +1 -1
- package/lib/util/behavior.d.ts +2 -2
- package/lib/util/behavior.js +2 -2
- package/lib/util/behavior.js.map +1 -1
- package/lib/util/data.d.ts +2 -2
- package/lib/util/data.js.map +1 -1
- package/lib/util/dom.d.ts +15 -0
- package/lib/util/dom.js +34 -0
- package/lib/util/dom.js.map +1 -0
- package/lib/util/extend.d.ts +1 -1
- package/lib/util/extend.js +0 -1
- package/lib/util/extend.js.map +1 -1
- package/lib/util/index.d.ts +7 -52
- package/lib/util/index.js +23 -23
- package/lib/util/index.js.map +1 -1
- package/lib/util/layout.d.ts +1 -1
- package/lib/util/layout.js.map +1 -1
- package/lib/util/loop.d.ts +1 -1
- package/lib/util/math.d.ts +1 -1
- package/lib/util/matrix.d.ts +6 -0
- package/lib/util/matrix.js +52 -0
- package/lib/util/matrix.js.map +1 -0
- package/lib/util/path.js +2 -2
- package/lib/util/path.js.map +1 -1
- package/lib/util/point.d.ts +1 -1
- package/lib/util/polyline.d.ts +2 -1
- package/lib/util/polyline.js +2 -1
- package/lib/util/polyline.js.map +1 -1
- package/lib/util/router.d.ts +1 -1
- package/lib/util/shape.js.map +1 -1
- package/lib/util/shape3d.js +1 -1
- package/lib/util/shape3d.js.map +1 -1
- package/package.json +32 -40
- package/src/api-doc/graph.ts +4 -3
- package/src/constant/shape.ts +1 -1
- package/src/index.ts +5 -6
- package/src/item/node.ts +0 -1
- package/src/runtime/controller/item.ts +15 -6
- package/src/runtime/controller/layout.ts +1 -5
- package/src/runtime/graph.ts +12 -6
- package/src/stdlib/behavior/drag-canvas.ts +1 -1
- package/src/stdlib/behavior/shortcuts-call.ts +13 -4
- package/src/stdlib/behavior/zoom-canvas-3d.ts +4 -1
- package/src/stdlib/index.ts +10 -1
- package/src/stdlib/item/edge/base.ts +5 -2
- package/src/stdlib/item/edge/cubic-horizontal.ts +0 -1
- package/src/stdlib/item/edge/cubic-vertical.ts +0 -1
- package/src/stdlib/item/edge/cubic.ts +1 -1
- package/src/stdlib/item/edge/loop.ts +1 -1
- package/src/stdlib/item/node/cube.ts +102 -0
- package/src/stdlib/item/node/index.ts +3 -0
- package/src/stdlib/plugin/edgeFilterLens/index.ts +387 -0
- package/src/stdlib/plugin/grid/index.ts +6 -6
- package/src/stdlib/plugin/hull/convexHull.ts +1 -1
- package/src/stdlib/plugin/hull/hullComponent.ts +2 -3
- package/src/stdlib/plugin/hull/util.ts +6 -2
- package/src/stdlib/plugin/index.ts +1 -0
- package/src/stdlib/plugin/legend/index.ts +6 -6
- package/src/stdlib/plugin/map/index.ts +7 -7
- package/src/stdlib/plugin/menu/index.ts +13 -13
- package/src/stdlib/plugin/minimap/index.ts +6 -6
- package/src/stdlib/plugin/timebar/index.ts +4 -4
- package/src/stdlib/plugin/toolbar/index.ts +8 -8
- package/src/stdlib/plugin/tooltip/index.ts +10 -10
- package/src/stdlib/plugin/types.ts +1 -0
- package/src/stdlib/plugin/watermaker/index.ts +302 -0
- package/src/types/plugin.ts +1 -1
- package/src/util/bbox.ts +4 -5
- package/src/util/behavior.ts +4 -4
- package/src/util/data.ts +2 -3
- package/src/util/dom.ts +33 -0
- package/src/util/extend.ts +2 -3
- package/src/util/index.ts +7 -24
- package/src/util/layout.ts +3 -2
- package/src/util/loop.ts +1 -1
- package/src/util/math.ts +1 -1
- package/src/util/matrix.ts +66 -0
- package/src/util/path.ts +1 -1
- package/src/util/point.ts +1 -1
- package/src/util/polyline.ts +2 -1
- package/src/util/router.ts +1 -1
- package/src/util/shape.ts +0 -1
- package/src/util/shape3d.ts +1 -1
|
@@ -225,9 +225,9 @@ export class ItemController {
|
|
|
225
225
|
|
|
226
226
|
// 0. clear groups on canvas, and create new groups
|
|
227
227
|
graph.canvas.removeChildren();
|
|
228
|
-
const comboGroup = new Group({ id: 'combo-group' });
|
|
229
|
-
const edgeGroup = new Group({ id: 'edge-group' });
|
|
230
|
-
const nodeGroup = new Group({ id: 'node-group' });
|
|
228
|
+
const comboGroup = new Group({ id: 'combo-group', style: { zIndex: 0 } });
|
|
229
|
+
const edgeGroup = new Group({ id: 'edge-group', style: { zIndex: 1 } });
|
|
230
|
+
const nodeGroup = new Group({ id: 'node-group', style: { zIndex: 2 } });
|
|
231
231
|
graph.canvas.appendChild(comboGroup);
|
|
232
232
|
graph.canvas.appendChild(edgeGroup);
|
|
233
233
|
graph.canvas.appendChild(nodeGroup);
|
|
@@ -237,9 +237,18 @@ export class ItemController {
|
|
|
237
237
|
|
|
238
238
|
// Also create transient groups on transient canvas.
|
|
239
239
|
transientCanvas.removeChildren();
|
|
240
|
-
this.transientComboGroup = new Group({
|
|
241
|
-
|
|
242
|
-
|
|
240
|
+
this.transientComboGroup = new Group({
|
|
241
|
+
id: 'combo-group',
|
|
242
|
+
style: { zIndex: 0 },
|
|
243
|
+
});
|
|
244
|
+
this.transientEdgeGroup = new Group({
|
|
245
|
+
id: 'edge-group',
|
|
246
|
+
style: { zIndex: 1 },
|
|
247
|
+
});
|
|
248
|
+
this.transientNodeGroup = new Group({
|
|
249
|
+
id: 'node-group',
|
|
250
|
+
style: { zIndex: 2 },
|
|
251
|
+
});
|
|
243
252
|
transientCanvas.appendChild(this.transientComboGroup);
|
|
244
253
|
transientCanvas.appendChild(this.transientEdgeGroup);
|
|
245
254
|
transientCanvas.appendChild(this.transientNodeGroup);
|
|
@@ -97,8 +97,6 @@ export class LayoutController {
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
this.graph.emit('startlayout');
|
|
101
|
-
|
|
102
100
|
const [width, height] = this.graph.getSize();
|
|
103
101
|
const center = [width / 2, height / 2];
|
|
104
102
|
|
|
@@ -227,8 +225,6 @@ export class LayoutController {
|
|
|
227
225
|
}
|
|
228
226
|
}
|
|
229
227
|
|
|
230
|
-
this.graph.emit('endlayout');
|
|
231
|
-
|
|
232
228
|
// Update nodes' positions.
|
|
233
229
|
this.updateNodesPosition(positions, animate);
|
|
234
230
|
}
|
|
@@ -279,7 +275,7 @@ export class LayoutController {
|
|
|
279
275
|
animationEffectTiming,
|
|
280
276
|
);
|
|
281
277
|
}
|
|
282
|
-
this.graph.emit('
|
|
278
|
+
this.graph.emit('afterlayout');
|
|
283
279
|
this.updateNodesPosition(
|
|
284
280
|
{ nodes: nodePositions, edges: [] },
|
|
285
281
|
animated || animate,
|
package/src/runtime/graph.ts
CHANGED
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
isString,
|
|
22
22
|
map,
|
|
23
23
|
} from '@antv/util';
|
|
24
|
-
import { createDom } from '@antv/dom-util';
|
|
25
24
|
import { History } from '../stdlib/plugin/history';
|
|
26
25
|
import { Command } from '../stdlib/plugin/history/command';
|
|
27
26
|
import type {
|
|
@@ -57,6 +56,7 @@ import { FitViewRules, GraphTransformOptions } from '../types/view';
|
|
|
57
56
|
import { changeRenderer, createCanvas } from '../util/canvas';
|
|
58
57
|
import { formatPadding } from '../util/shape';
|
|
59
58
|
import { getLayoutBounds } from '../util/layout';
|
|
59
|
+
import { createDOM } from '../util/dom';
|
|
60
60
|
import { Plugin as PluginBase } from '../types/plugin';
|
|
61
61
|
import { ComboMapper, EdgeMapper, NodeMapper } from '../types/spec';
|
|
62
62
|
import {
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
import { PluginController } from './controller/plugin';
|
|
72
72
|
import Hook from './hooks';
|
|
73
73
|
|
|
74
|
-
export
|
|
74
|
+
export class Graph<B extends BehaviorRegistry, T extends ThemeRegistry>
|
|
75
75
|
extends EventEmitter
|
|
76
76
|
implements IGraph<B, T>
|
|
77
77
|
{
|
|
@@ -180,7 +180,7 @@ export default class Graph<B extends BehaviorRegistry, T extends ThemeRegistry>
|
|
|
180
180
|
this.canvas = canvas;
|
|
181
181
|
this.backgroundCanvas = backgroundCanvas;
|
|
182
182
|
this.transientCanvas = transientCanvas;
|
|
183
|
-
this.container = container as
|
|
183
|
+
this.container = container as HTMLElement;
|
|
184
184
|
} else {
|
|
185
185
|
const containerDOM = isString(container)
|
|
186
186
|
? document.getElementById(container as string)
|
|
@@ -236,7 +236,8 @@ export default class Graph<B extends BehaviorRegistry, T extends ThemeRegistry>
|
|
|
236
236
|
.getContextService()
|
|
237
237
|
.getDomElement() as unknown as HTMLElement;
|
|
238
238
|
if ($domElement && $domElement.style) {
|
|
239
|
-
|
|
239
|
+
// Make all these 3 canvas doms overlap each other. The container already has `position: relative` style.
|
|
240
|
+
$domElement.style.position = 'absolute';
|
|
240
241
|
$domElement.style.outline = 'none';
|
|
241
242
|
$domElement.tabIndex = 1; // Enable keyboard events
|
|
242
243
|
// Transient canvas should let interactive events go through.
|
|
@@ -881,9 +882,14 @@ export default class Graph<B extends BehaviorRegistry, T extends ThemeRegistry>
|
|
|
881
882
|
);
|
|
882
883
|
return;
|
|
883
884
|
}
|
|
885
|
+
const oldSize = [this.specification.width, this.specification.height];
|
|
886
|
+
this.emit('beforesetsize', { oldSize, size: size });
|
|
884
887
|
this.specification.width = size[0];
|
|
885
888
|
this.specification.height = size[1];
|
|
886
889
|
this.canvas.resize(size[0], size[1]);
|
|
890
|
+
this.transientCanvas.resize(size[0], size[1]);
|
|
891
|
+
this.backgroundCanvas.resize(size[0], size[1]);
|
|
892
|
+
this.emit('aftersetsize', { oldSize, size: size });
|
|
887
893
|
}
|
|
888
894
|
|
|
889
895
|
public getCanvasRange(): Bounds {
|
|
@@ -2188,7 +2194,7 @@ export default class Graph<B extends BehaviorRegistry, T extends ThemeRegistry>
|
|
|
2188
2194
|
const width = this.getSize()[0];
|
|
2189
2195
|
const height = this.getSize()[1];
|
|
2190
2196
|
|
|
2191
|
-
const vContainerDOM:
|
|
2197
|
+
const vContainerDOM: HTMLElement = createDOM(
|
|
2192
2198
|
'<div id="virtual-image"></div>',
|
|
2193
2199
|
);
|
|
2194
2200
|
const vCanvas = createCanvas(
|
|
@@ -2296,7 +2302,7 @@ export default class Graph<B extends BehaviorRegistry, T extends ThemeRegistry>
|
|
|
2296
2302
|
typeof window !== 'undefined' ? window.devicePixelRatio : 1;
|
|
2297
2303
|
const vWidth = halfX * 2;
|
|
2298
2304
|
const vHeight = halfY * 2;
|
|
2299
|
-
const vContainerDOM:
|
|
2305
|
+
const vContainerDOM: HTMLElement = createDOM(
|
|
2300
2306
|
'<div id="virtual-image"></div>',
|
|
2301
2307
|
);
|
|
2302
2308
|
const vCanvas = createCanvas(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isNumber } from '@antv/util';
|
|
2
|
-
import { ID, IG6GraphEvent } from '../../types';
|
|
3
2
|
import { Behavior } from '../../types/behavior';
|
|
4
3
|
import { Point } from '../../types/common';
|
|
4
|
+
import { ID, IG6GraphEvent } from '../../types';
|
|
5
5
|
|
|
6
6
|
const VALID_TRIGGERS = ['drag', 'directionKeys'];
|
|
7
7
|
export interface DragCanvasOptions {
|
|
@@ -78,8 +78,6 @@ export class ShortcutsCall extends Behavior {
|
|
|
78
78
|
(codeLowerCase === 'ctrl' && triggerLowerCase === 'control')
|
|
79
79
|
) {
|
|
80
80
|
this.triggerKeydown = true;
|
|
81
|
-
} else {
|
|
82
|
-
this.triggerKeydown = false;
|
|
83
81
|
}
|
|
84
82
|
}
|
|
85
83
|
|
|
@@ -114,7 +112,18 @@ export class ShortcutsCall extends Behavior {
|
|
|
114
112
|
}
|
|
115
113
|
}
|
|
116
114
|
|
|
117
|
-
public onKeyUp() {
|
|
118
|
-
|
|
115
|
+
public onKeyUp(e) {
|
|
116
|
+
const code = e.key;
|
|
117
|
+
if (!code) return;
|
|
118
|
+
const { trigger } = this.options;
|
|
119
|
+
const triggerLowerCase = trigger.toLowerCase();
|
|
120
|
+
const codeLowerCase = code.toLowerCase();
|
|
121
|
+
if (
|
|
122
|
+
codeLowerCase === triggerLowerCase ||
|
|
123
|
+
(codeLowerCase === 'control' && triggerLowerCase === 'ctrl') ||
|
|
124
|
+
(codeLowerCase === 'ctrl' && triggerLowerCase === 'control')
|
|
125
|
+
) {
|
|
126
|
+
this.triggerKeydown = false;
|
|
127
|
+
}
|
|
119
128
|
}
|
|
120
129
|
}
|
|
@@ -123,7 +123,10 @@ export class ZoomCanvas3D extends Behavior {
|
|
|
123
123
|
((100 * sign * sensitivity) / currentDistance) *
|
|
124
124
|
Math.sqrt(currentDistance);
|
|
125
125
|
const toDistance = currentDistance + dolly;
|
|
126
|
-
const
|
|
126
|
+
const azimuth = camera.getAzimuth();
|
|
127
|
+
const isFlipped = azimuth < 90 && azimuth > -90 ? 1 : -1;
|
|
128
|
+
const distancePositive = camera.getDistanceVector()[2] < 0 ? 1 : -1;
|
|
129
|
+
const cameraFrontOfFocalPoint = isFlipped * distancePositive > 0;
|
|
127
130
|
|
|
128
131
|
// zoom out constraint
|
|
129
132
|
if (
|
package/src/stdlib/index.ts
CHANGED
|
@@ -32,6 +32,9 @@ const {
|
|
|
32
32
|
EllipseNode,
|
|
33
33
|
ModelRectNode,
|
|
34
34
|
ImageNode,
|
|
35
|
+
CubeNode,
|
|
36
|
+
BaseNode,
|
|
37
|
+
BaseNode3D,
|
|
35
38
|
} = Nodes;
|
|
36
39
|
|
|
37
40
|
const {
|
|
@@ -76,6 +79,7 @@ const {
|
|
|
76
79
|
Toolbar,
|
|
77
80
|
Timebar,
|
|
78
81
|
Snapline,
|
|
82
|
+
EdgeFilterLens,
|
|
79
83
|
} = Plugins;
|
|
80
84
|
|
|
81
85
|
const {
|
|
@@ -96,6 +100,7 @@ const {
|
|
|
96
100
|
import lassoSelector from './selector/lasso';
|
|
97
101
|
import rectSelector from './selector/rect';
|
|
98
102
|
import Hull from './plugin/hull';
|
|
103
|
+
import { WaterMarker } from './plugin/watermaker';
|
|
99
104
|
|
|
100
105
|
const stdLib = {
|
|
101
106
|
transforms: {
|
|
@@ -123,7 +128,6 @@ const stdLib = {
|
|
|
123
128
|
'zoom-canvas': ZoomCanvas,
|
|
124
129
|
'drag-node': DragNode,
|
|
125
130
|
'drag-combo': DragCombo,
|
|
126
|
-
'create-edge': CreateEdge,
|
|
127
131
|
'collapse-expand-combo': CollapseExpandCombo,
|
|
128
132
|
'collapse-expand-tree': CollapseExpandTree,
|
|
129
133
|
'click-select': ClickSelect,
|
|
@@ -246,6 +250,9 @@ const Extensions = {
|
|
|
246
250
|
TriangleNode,
|
|
247
251
|
EllipseNode,
|
|
248
252
|
ModelRectNode,
|
|
253
|
+
CubeNode,
|
|
254
|
+
BaseNode,
|
|
255
|
+
BaseNode3D,
|
|
249
256
|
// edges
|
|
250
257
|
LineEdge,
|
|
251
258
|
CubicEdge,
|
|
@@ -289,6 +296,8 @@ const Extensions = {
|
|
|
289
296
|
Timebar,
|
|
290
297
|
Hull,
|
|
291
298
|
Snapline,
|
|
299
|
+
EdgeFilterLens,
|
|
300
|
+
WaterMarker,
|
|
292
301
|
};
|
|
293
302
|
|
|
294
303
|
export default registery;
|
|
@@ -289,9 +289,10 @@ export abstract class BaseEdge {
|
|
|
289
289
|
const pointOffset = (keyShape as Line | Polyline).getPoint(
|
|
290
290
|
positionPreset.pointRatio[1],
|
|
291
291
|
);
|
|
292
|
-
|
|
292
|
+
let angle = Math.atan(
|
|
293
293
|
(point.y - pointOffset.y) / (point.x - pointOffset.x),
|
|
294
|
-
);
|
|
294
|
+
);
|
|
295
|
+
if (isNaN(angle)) angle = 0;
|
|
295
296
|
|
|
296
297
|
// revert
|
|
297
298
|
isRevert = pointOffset.x < point.x;
|
|
@@ -331,6 +332,7 @@ export abstract class BaseEdge {
|
|
|
331
332
|
maxWidth,
|
|
332
333
|
this.zoomCache.zoom,
|
|
333
334
|
);
|
|
335
|
+
this.zoomCache.wordWrapWidth = wordWrapWidth;
|
|
334
336
|
const style = {
|
|
335
337
|
...this.defaultStyles.labelShape,
|
|
336
338
|
textAlign: positionPreset.textAlign,
|
|
@@ -339,6 +341,7 @@ export abstract class BaseEdge {
|
|
|
339
341
|
...positionStyle,
|
|
340
342
|
...otherStyle,
|
|
341
343
|
};
|
|
344
|
+
this.boundsCache.labelShapeTransform = style.transform;
|
|
342
345
|
return this.upsertShape('text', 'labelShape', style, shapeMap, model);
|
|
343
346
|
}
|
|
344
347
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DisplayObject } from '@antv/g';
|
|
2
|
-
import { vec2 } from '
|
|
2
|
+
import { vec2 } from 'gl-matrix';
|
|
3
3
|
import { Point } from '../../../types/common';
|
|
4
4
|
import { EdgeModelData, EdgeShapeMap } from '../../../types/edge';
|
|
5
5
|
import { State } from '../../../types/item';
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { DisplayObject } from '@antv/g';
|
|
2
|
+
import { NodeDisplayModel } from '../../../types';
|
|
3
|
+
import { State } from '../../../types/item';
|
|
4
|
+
import {
|
|
5
|
+
NodeModelData,
|
|
6
|
+
NodeShapeMap,
|
|
7
|
+
NodeShapeStyles,
|
|
8
|
+
} from '../../../types/node';
|
|
9
|
+
import { BaseNode3D } from './base3d';
|
|
10
|
+
|
|
11
|
+
export class CubeNode extends BaseNode3D {
|
|
12
|
+
override defaultStyles = {
|
|
13
|
+
keyShape: {
|
|
14
|
+
latitudeBands: 32,
|
|
15
|
+
longitudeBands: 32,
|
|
16
|
+
width: 10,
|
|
17
|
+
height: 10,
|
|
18
|
+
depth: 10,
|
|
19
|
+
x: 0,
|
|
20
|
+
y: 0,
|
|
21
|
+
z: 0,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
mergedStyles: NodeShapeStyles;
|
|
25
|
+
constructor(props) {
|
|
26
|
+
super(props);
|
|
27
|
+
}
|
|
28
|
+
public draw(
|
|
29
|
+
model: NodeDisplayModel,
|
|
30
|
+
shapeMap: NodeShapeMap,
|
|
31
|
+
diffData?: { previous: NodeModelData; current: NodeModelData },
|
|
32
|
+
diffState?: { previous: State[]; current: State[] },
|
|
33
|
+
): NodeShapeMap {
|
|
34
|
+
const { data = {} } = model;
|
|
35
|
+
|
|
36
|
+
let shapes: NodeShapeMap = { keyShape: undefined };
|
|
37
|
+
|
|
38
|
+
// keyShape
|
|
39
|
+
shapes.keyShape = this.drawKeyShape(model, shapeMap, diffData);
|
|
40
|
+
|
|
41
|
+
// haloShape
|
|
42
|
+
if (data.haloShape && this.drawHaloShape) {
|
|
43
|
+
shapes.haloShape = this.drawHaloShape(model, shapeMap, diffData);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// labelShape
|
|
47
|
+
if (data.labelShape) {
|
|
48
|
+
shapes.labelShape = this.drawLabelShape(model, shapeMap, diffData);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// labelBackgroundShape
|
|
52
|
+
if (data.labelBackgroundShape) {
|
|
53
|
+
shapes.labelBackgroundShape = this.drawLabelBackgroundShape(
|
|
54
|
+
model,
|
|
55
|
+
shapeMap,
|
|
56
|
+
diffData,
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// iconShape
|
|
61
|
+
if (data.iconShape) {
|
|
62
|
+
shapes.iconShape = this.drawIconShape(model, shapeMap, diffData);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// badgeShape
|
|
66
|
+
if (data.badgeShapes) {
|
|
67
|
+
const badgeShapes = this.drawBadgeShapes(
|
|
68
|
+
model,
|
|
69
|
+
shapeMap,
|
|
70
|
+
diffData,
|
|
71
|
+
diffState,
|
|
72
|
+
);
|
|
73
|
+
shapes = {
|
|
74
|
+
...shapes,
|
|
75
|
+
...badgeShapes,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// otherShapes
|
|
80
|
+
if (data.otherShapes && this.drawOtherShapes) {
|
|
81
|
+
shapes = {
|
|
82
|
+
...shapes,
|
|
83
|
+
...this.drawOtherShapes(model, shapeMap, diffData),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return shapes;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public drawKeyShape(
|
|
90
|
+
model: NodeDisplayModel,
|
|
91
|
+
shapeMap: NodeShapeMap,
|
|
92
|
+
diffData?: { previous: NodeModelData; current: NodeModelData },
|
|
93
|
+
diffState?: { previous: State[]; current: State[] },
|
|
94
|
+
): DisplayObject {
|
|
95
|
+
return this.upsertShape(
|
|
96
|
+
'cube',
|
|
97
|
+
'keyShape',
|
|
98
|
+
this.mergedStyles.keyShape,
|
|
99
|
+
shapeMap,
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
}
|