@antv/g6 5.0.0-beta.3 → 5.0.0-beta.5
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 +2 -0
- package/esm/index.d.ts +4 -1
- package/esm/index.js +1 -1
- package/esm/item/edge.d.ts +1 -0
- package/esm/item/edge.js +3 -1
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.d.ts +3 -2
- package/esm/item/item.js +12 -6
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +1 -0
- package/esm/item/node.js +11 -4
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/item.js +252 -148
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/graph.d.ts +16 -14
- package/esm/runtime/graph.js +66 -28
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/activate-relations.js +2 -2
- package/esm/stdlib/behavior/activate-relations.js.map +1 -1
- package/esm/stdlib/behavior/click-select.js +1 -1
- package/esm/stdlib/behavior/click-select.js.map +1 -1
- package/esm/stdlib/behavior/drag-canvas.js +50 -27
- 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.js +10 -10
- package/esm/stdlib/behavior/drag-node.js.map +1 -1
- package/esm/stdlib/behavior/zoom-canvas.js +47 -24
- package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/esm/stdlib/index.d.ts +3 -0
- package/esm/stdlib/index.js +12 -9
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/edge/base.d.ts +1 -1
- package/esm/stdlib/item/edge/base.js +13 -4
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/node/base.d.ts +1 -1
- package/esm/stdlib/item/node/base.js +18 -26
- package/esm/stdlib/item/node/base.js.map +1 -1
- package/esm/stdlib/item/node/diamond.js +1 -1
- package/esm/stdlib/item/node/ellipse.js +2 -2
- package/esm/stdlib/item/node/hexagon.js +6 -2
- package/esm/stdlib/item/node/hexagon.js.map +1 -1
- package/esm/stdlib/item/node/image.d.ts +40 -0
- package/esm/stdlib/item/node/image.js +110 -0
- package/esm/stdlib/item/node/image.js.map +1 -0
- package/esm/stdlib/item/node/index.d.ts +1 -0
- package/esm/stdlib/item/node/index.js +1 -0
- package/esm/stdlib/item/node/index.js.map +1 -1
- package/esm/stdlib/plugin/history/combo-command.js +2 -2
- package/esm/stdlib/plugin/history/combo-command.js.map +1 -1
- package/esm/stdlib/plugin/history/index.d.ts +10 -10
- package/esm/stdlib/plugin/history/index.js +14 -14
- package/esm/stdlib/plugin/history/index.js.map +1 -1
- package/esm/stdlib/plugin/history/item-data-command.js +4 -4
- package/esm/stdlib/plugin/history/item-data-command.js.map +1 -1
- package/esm/stdlib/plugin/history/layer-updated-command.js +2 -2
- package/esm/stdlib/plugin/history/layer-updated-command.js.map +1 -1
- package/esm/stdlib/plugin/history/state-updated-command.js +1 -1
- package/esm/stdlib/plugin/history/state-updated-command.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/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/snapline/index.d.ts +163 -0
- package/esm/stdlib/plugin/snapline/index.js +1052 -0
- package/esm/stdlib/plugin/snapline/index.js.map +1 -0
- package/esm/stdlib/plugin/types.d.ts +1 -0
- package/esm/stdlib/theme/dark.js +42 -2
- package/esm/stdlib/theme/dark.js.map +1 -1
- package/esm/stdlib/theme/light.js +4 -4
- package/esm/types/graph.d.ts +14 -14
- package/esm/types/hook.d.ts +6 -0
- package/esm/types/item.d.ts +6 -0
- package/esm/types/item.js.map +1 -1
- package/esm/types/spec.d.ts +13 -0
- package/esm/util/bbox.d.ts +16 -1
- package/esm/util/bbox.js +29 -0
- package/esm/util/bbox.js.map +1 -1
- package/esm/util/shape.js +2 -2
- package/esm/util/shape.js.map +1 -1
- package/lib/constant/shape.d.ts +2 -0
- package/lib/index.d.ts +4 -1
- package/lib/index.js +1 -1
- package/lib/item/edge.d.ts +1 -0
- package/lib/item/edge.js +3 -1
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.d.ts +3 -2
- package/lib/item/item.js +12 -6
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +1 -0
- package/lib/item/node.js +11 -4
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/item.js +251 -147
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/graph.d.ts +16 -14
- package/lib/runtime/graph.js +66 -28
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/activate-relations.js +2 -2
- package/lib/stdlib/behavior/activate-relations.js.map +1 -1
- package/lib/stdlib/behavior/click-select.js +1 -1
- package/lib/stdlib/behavior/click-select.js.map +1 -1
- package/lib/stdlib/behavior/drag-canvas.js +50 -27
- 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.js +10 -10
- package/lib/stdlib/behavior/drag-node.js.map +1 -1
- package/lib/stdlib/behavior/zoom-canvas.js +47 -24
- package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/lib/stdlib/index.d.ts +3 -0
- package/lib/stdlib/index.js +12 -9
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/edge/base.d.ts +1 -1
- package/lib/stdlib/item/edge/base.js +13 -4
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/node/base.d.ts +1 -1
- package/lib/stdlib/item/node/base.js +18 -26
- package/lib/stdlib/item/node/base.js.map +1 -1
- package/lib/stdlib/item/node/diamond.js +1 -1
- package/lib/stdlib/item/node/ellipse.js +2 -2
- package/lib/stdlib/item/node/hexagon.js +6 -2
- package/lib/stdlib/item/node/hexagon.js.map +1 -1
- package/lib/stdlib/item/node/image.d.ts +40 -0
- package/lib/stdlib/item/node/image.js +114 -0
- package/lib/stdlib/item/node/image.js.map +1 -0
- package/lib/stdlib/item/node/index.d.ts +1 -0
- package/lib/stdlib/item/node/index.js +1 -0
- package/lib/stdlib/item/node/index.js.map +1 -1
- package/lib/stdlib/plugin/history/combo-command.js +2 -2
- package/lib/stdlib/plugin/history/combo-command.js.map +1 -1
- package/lib/stdlib/plugin/history/index.d.ts +10 -10
- package/lib/stdlib/plugin/history/index.js +14 -14
- package/lib/stdlib/plugin/history/index.js.map +1 -1
- package/lib/stdlib/plugin/history/item-data-command.js +4 -4
- package/lib/stdlib/plugin/history/item-data-command.js.map +1 -1
- package/lib/stdlib/plugin/history/layer-updated-command.js +2 -2
- package/lib/stdlib/plugin/history/layer-updated-command.js.map +1 -1
- package/lib/stdlib/plugin/history/state-updated-command.js +1 -1
- package/lib/stdlib/plugin/history/state-updated-command.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/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/snapline/index.d.ts +163 -0
- package/lib/stdlib/plugin/snapline/index.js +1056 -0
- package/lib/stdlib/plugin/snapline/index.js.map +1 -0
- package/lib/stdlib/plugin/types.d.ts +1 -0
- package/lib/stdlib/theme/dark.js +42 -2
- package/lib/stdlib/theme/dark.js.map +1 -1
- package/lib/stdlib/theme/light.js +4 -4
- package/lib/types/graph.d.ts +14 -14
- package/lib/types/hook.d.ts +6 -0
- package/lib/types/item.d.ts +6 -0
- package/lib/types/item.js.map +1 -1
- package/lib/types/spec.d.ts +13 -0
- package/lib/util/bbox.d.ts +16 -1
- package/lib/util/bbox.js +32 -1
- package/lib/util/bbox.js.map +1 -1
- package/lib/util/shape.js +2 -2
- package/lib/util/shape.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +1 -1
- package/src/item/edge.ts +4 -1
- package/src/item/item.ts +11 -6
- package/src/item/node.ts +18 -10
- package/src/runtime/controller/item.ts +212 -66
- package/src/runtime/graph.ts +91 -29
- package/src/stdlib/behavior/activate-relations.ts +2 -2
- package/src/stdlib/behavior/click-select.ts +1 -1
- package/src/stdlib/behavior/drag-canvas.ts +65 -27
- package/src/stdlib/behavior/drag-combo.ts +8 -8
- package/src/stdlib/behavior/drag-node.ts +10 -10
- package/src/stdlib/behavior/zoom-canvas.ts +60 -24
- package/src/stdlib/index.ts +12 -7
- package/src/stdlib/item/edge/base.ts +13 -5
- package/src/stdlib/item/node/base.ts +24 -29
- package/src/stdlib/item/node/diamond.ts +1 -1
- package/src/stdlib/item/node/ellipse.ts +2 -2
- package/src/stdlib/item/node/hexagon.ts +6 -2
- package/src/stdlib/item/node/image.ts +190 -0
- package/src/stdlib/item/node/index.ts +1 -0
- package/src/stdlib/plugin/history/combo-command.ts +2 -2
- package/src/stdlib/plugin/history/index.ts +14 -14
- package/src/stdlib/plugin/history/item-data-command.ts +4 -4
- package/src/stdlib/plugin/history/layer-updated-command.ts +2 -2
- package/src/stdlib/plugin/history/state-updated-command.ts +1 -1
- package/src/stdlib/plugin/history/visibility-updated-command.ts +2 -2
- package/src/stdlib/plugin/index.ts +1 -0
- package/src/stdlib/plugin/snapline/index.ts +1277 -0
- package/src/stdlib/plugin/types.ts +1 -0
- package/src/stdlib/theme/dark.ts +66 -2
- package/src/stdlib/theme/light.ts +4 -4
- package/src/types/graph.ts +22 -17
- package/src/types/hook.ts +6 -0
- package/src/types/item.ts +10 -0
- package/src/types/spec.ts +13 -0
- package/src/util/bbox.ts +38 -1
- package/src/util/shape.ts +2 -2
package/src/stdlib/theme/dark.ts
CHANGED
|
@@ -7,6 +7,7 @@ const textColor = 'rgba(255,255,255,0.85)';
|
|
|
7
7
|
const nodeColor = 'rgb(34,126,255)';
|
|
8
8
|
const edgeColor = 'rgb(153, 173, 209)';
|
|
9
9
|
const comboFill = 'rgb(253, 253, 253)';
|
|
10
|
+
const comboStroke = 'rgba(153,173,209,1)';
|
|
10
11
|
const disabledFill = '#D0E4FF';
|
|
11
12
|
|
|
12
13
|
const edgeMainStroke = '#637088';
|
|
@@ -105,7 +106,7 @@ export const DarkTheme = {
|
|
|
105
106
|
},
|
|
106
107
|
haloShape: {
|
|
107
108
|
opacity: 0.45,
|
|
108
|
-
lineWidth:
|
|
109
|
+
lineWidth: 12,
|
|
109
110
|
zIndex: -1,
|
|
110
111
|
pointerEvents: 'none',
|
|
111
112
|
visible: true,
|
|
@@ -118,7 +119,7 @@ export const DarkTheme = {
|
|
|
118
119
|
},
|
|
119
120
|
haloShape: {
|
|
120
121
|
opacity: 0.25,
|
|
121
|
-
lineWidth:
|
|
122
|
+
lineWidth: 12,
|
|
122
123
|
zIndex: -1,
|
|
123
124
|
pointerEvents: 'none',
|
|
124
125
|
visible: true,
|
|
@@ -301,6 +302,23 @@ export const DarkTheme = {
|
|
|
301
302
|
height: 10,
|
|
302
303
|
padding: [25, 20, 15, 20],
|
|
303
304
|
},
|
|
305
|
+
labelShape: {
|
|
306
|
+
...DEFAULT_TEXT_STYLE,
|
|
307
|
+
fill: textColor,
|
|
308
|
+
opacity: 0.85,
|
|
309
|
+
position: 'bottom',
|
|
310
|
+
zIndex: 2,
|
|
311
|
+
lod: 0,
|
|
312
|
+
maxLines: 1,
|
|
313
|
+
},
|
|
314
|
+
labelBackgroundShape: {
|
|
315
|
+
padding: [2, 4, 2, 4],
|
|
316
|
+
lineWidth: 0,
|
|
317
|
+
fill: '#000',
|
|
318
|
+
opacity: 0.75,
|
|
319
|
+
zIndex: 1,
|
|
320
|
+
lod: 0,
|
|
321
|
+
},
|
|
304
322
|
},
|
|
305
323
|
selected: {
|
|
306
324
|
keyShape: {
|
|
@@ -311,12 +329,30 @@ export const DarkTheme = {
|
|
|
311
329
|
labelShape: {
|
|
312
330
|
fontWeight: 700,
|
|
313
331
|
},
|
|
332
|
+
haloShape: {
|
|
333
|
+
opacity: 0.25,
|
|
334
|
+
lineWidth: 12,
|
|
335
|
+
pointerEvents: 'none',
|
|
336
|
+
zIndex: -1,
|
|
337
|
+
visible: true,
|
|
338
|
+
stroke: comboStroke,
|
|
339
|
+
droppable: false,
|
|
340
|
+
},
|
|
314
341
|
},
|
|
315
342
|
active: {
|
|
316
343
|
keyShape: {
|
|
317
344
|
stroke: nodeStroke,
|
|
318
345
|
lineWidth: 1,
|
|
319
346
|
},
|
|
347
|
+
haloShape: {
|
|
348
|
+
opacity: 0.25,
|
|
349
|
+
lineWidth: 12,
|
|
350
|
+
pointerEvents: 'none',
|
|
351
|
+
zIndex: -1,
|
|
352
|
+
visible: true,
|
|
353
|
+
stroke: comboStroke,
|
|
354
|
+
droppable: false,
|
|
355
|
+
},
|
|
320
356
|
},
|
|
321
357
|
highlight: {
|
|
322
358
|
keyShape: {
|
|
@@ -334,6 +370,9 @@ export const DarkTheme = {
|
|
|
334
370
|
fill: comboFill,
|
|
335
371
|
lineWidth: 1,
|
|
336
372
|
},
|
|
373
|
+
labelShape: {
|
|
374
|
+
opacity: 0.65,
|
|
375
|
+
},
|
|
337
376
|
},
|
|
338
377
|
disable: {
|
|
339
378
|
keyShape: {
|
|
@@ -344,6 +383,31 @@ export const DarkTheme = {
|
|
|
344
383
|
fill: disabledFill,
|
|
345
384
|
opacity: 0.25,
|
|
346
385
|
},
|
|
386
|
+
labelShape: {
|
|
387
|
+
opacity: 0.25,
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
collapsed: {
|
|
391
|
+
keyShape: {
|
|
392
|
+
...DEFAULT_SHAPE_STYLE,
|
|
393
|
+
fill: comboFill,
|
|
394
|
+
lineWidth: 1,
|
|
395
|
+
stroke: comboStroke,
|
|
396
|
+
// the collapsed size
|
|
397
|
+
r: 16,
|
|
398
|
+
width: 48,
|
|
399
|
+
height: 24,
|
|
400
|
+
padding: [25, 20, 15, 20],
|
|
401
|
+
},
|
|
402
|
+
iconShape: {
|
|
403
|
+
...DEFAULT_TEXT_STYLE,
|
|
404
|
+
fill: comboStroke,
|
|
405
|
+
fontSize: 12,
|
|
406
|
+
zIndex: 1,
|
|
407
|
+
lod: -1,
|
|
408
|
+
contentType: 'childCount',
|
|
409
|
+
visible: true,
|
|
410
|
+
},
|
|
347
411
|
},
|
|
348
412
|
},
|
|
349
413
|
],
|
|
@@ -108,7 +108,7 @@ export const LightTheme = {
|
|
|
108
108
|
},
|
|
109
109
|
haloShape: {
|
|
110
110
|
opacity: 0.25,
|
|
111
|
-
lineWidth:
|
|
111
|
+
lineWidth: 12,
|
|
112
112
|
pointerEvents: 'none',
|
|
113
113
|
zIndex: -1,
|
|
114
114
|
visible: true,
|
|
@@ -121,7 +121,7 @@ export const LightTheme = {
|
|
|
121
121
|
},
|
|
122
122
|
haloShape: {
|
|
123
123
|
opacity: 0.25,
|
|
124
|
-
lineWidth:
|
|
124
|
+
lineWidth: 12,
|
|
125
125
|
pointerEvents: 'none',
|
|
126
126
|
zIndex: -1,
|
|
127
127
|
visible: true,
|
|
@@ -328,7 +328,7 @@ export const LightTheme = {
|
|
|
328
328
|
},
|
|
329
329
|
haloShape: {
|
|
330
330
|
opacity: 0.25,
|
|
331
|
-
lineWidth:
|
|
331
|
+
lineWidth: 12,
|
|
332
332
|
pointerEvents: 'none',
|
|
333
333
|
zIndex: -1,
|
|
334
334
|
visible: true,
|
|
@@ -343,7 +343,7 @@ export const LightTheme = {
|
|
|
343
343
|
},
|
|
344
344
|
haloShape: {
|
|
345
345
|
opacity: 0.25,
|
|
346
|
-
lineWidth:
|
|
346
|
+
lineWidth: 12,
|
|
347
347
|
pointerEvents: 'none',
|
|
348
348
|
zIndex: -1,
|
|
349
349
|
visible: true,
|
package/src/types/graph.ts
CHANGED
|
@@ -5,14 +5,14 @@ import { Command } from '../stdlib/plugin/history/command';
|
|
|
5
5
|
import { Hooks } from '../types/hook';
|
|
6
6
|
import { CameraAnimationOptions } from './animate';
|
|
7
7
|
import { BehaviorOptionsOf, BehaviorRegistry } from './behavior';
|
|
8
|
-
import {
|
|
8
|
+
import { ComboModel, ComboUserModel } from './combo';
|
|
9
9
|
import { Padding, Point } from './common';
|
|
10
10
|
import { GraphData } from './data';
|
|
11
|
-
import {
|
|
11
|
+
import { EdgeModel, EdgeUserModel } from './edge';
|
|
12
12
|
import type { StackType } from './history';
|
|
13
13
|
import { ITEM_TYPE, SHAPE_TYPE } from './item';
|
|
14
14
|
import { LayoutOptions } from './layout';
|
|
15
|
-
import {
|
|
15
|
+
import { NodeModel, NodeUserModel } from './node';
|
|
16
16
|
import { RendererName } from './render';
|
|
17
17
|
import { Specification } from './spec';
|
|
18
18
|
import { ThemeOptionsOf, ThemeRegistry } from './theme';
|
|
@@ -470,7 +470,11 @@ export interface IGraph<
|
|
|
470
470
|
* @returns
|
|
471
471
|
* @group Item
|
|
472
472
|
*/
|
|
473
|
-
hideItem: (
|
|
473
|
+
hideItem: (
|
|
474
|
+
ids: ID | ID[],
|
|
475
|
+
disableAnimate?: boolean,
|
|
476
|
+
keepKeyShape?: boolean,
|
|
477
|
+
) => void;
|
|
474
478
|
/**
|
|
475
479
|
* Make the item(s) to the front.
|
|
476
480
|
* @param ids the item id(s) to front
|
|
@@ -682,16 +686,16 @@ export interface IGraph<
|
|
|
682
686
|
/**
|
|
683
687
|
* Pause stacking operation.
|
|
684
688
|
*/
|
|
685
|
-
|
|
689
|
+
pauseStack: () => void;
|
|
686
690
|
/**
|
|
687
691
|
* Resume stacking operation.
|
|
688
692
|
*/
|
|
689
|
-
|
|
693
|
+
resumeStack: () => void;
|
|
690
694
|
/**
|
|
691
695
|
* Execute a callback without allowing any stacking operations.
|
|
692
696
|
* @param callback
|
|
693
697
|
*/
|
|
694
|
-
|
|
698
|
+
executeWithNoStack: (callback: () => void) => void;
|
|
695
699
|
/**
|
|
696
700
|
* Retrieve the current redo stack which consists of operations that could be undone
|
|
697
701
|
*/
|
|
@@ -731,33 +735,34 @@ export interface IGraph<
|
|
|
731
735
|
canRedo: () => void;
|
|
732
736
|
|
|
733
737
|
/**
|
|
734
|
-
* Begin a
|
|
735
|
-
* Any operations performed between `
|
|
738
|
+
* Begin a historyBatch operation.
|
|
739
|
+
* Any operations performed between `startHistoryBatch` and `stopHistoryBatch` are grouped together.
|
|
736
740
|
* treated as a single operation when undoing or redoing.
|
|
737
741
|
*/
|
|
738
|
-
|
|
742
|
+
startHistoryBatch: () => void;
|
|
739
743
|
|
|
740
744
|
/**
|
|
741
|
-
* End a
|
|
742
|
-
* Any operations performed between `
|
|
745
|
+
* End a historyBatch operation.
|
|
746
|
+
* Any operations performed between `startHistoryBatch` and `stopHistoryBatch` are grouped together.
|
|
743
747
|
* treated as a single operation when undoing or redoing.
|
|
744
748
|
*/
|
|
745
|
-
|
|
749
|
+
stopHistoryBatch: () => void;
|
|
746
750
|
|
|
747
751
|
/**
|
|
748
752
|
* Execute a provided function within a batched context
|
|
749
753
|
* All operations performed inside callback will be treated as a composite operation
|
|
750
|
-
* more convenient way without manually invoking `
|
|
754
|
+
* more convenient way without manually invoking `startHistoryBatch` and `stopHistoryBatch`.
|
|
751
755
|
* @param callback The func containing operations to be batched together.
|
|
752
756
|
*/
|
|
753
|
-
|
|
757
|
+
historyBatch: (callback: () => void) => void;
|
|
758
|
+
|
|
754
759
|
/**
|
|
755
760
|
* Execute a provided function within a batched context
|
|
756
761
|
* All operations performed inside callback will be treated as a composite operation
|
|
757
|
-
* more convenient way without manually invoking `
|
|
762
|
+
* more convenient way without manually invoking `startHistoryBatch` and `stopHistoryBatch`.
|
|
758
763
|
* @param callback The func containing operations to be batched together.
|
|
759
764
|
*/
|
|
760
|
-
|
|
765
|
+
cleanHistory: (stackType?: StackType) => void;
|
|
761
766
|
// ===== tree operations =====
|
|
762
767
|
/**
|
|
763
768
|
* Collapse sub tree(s).
|
package/src/types/hook.ts
CHANGED
|
@@ -24,6 +24,7 @@ export interface IHook<T> {
|
|
|
24
24
|
export type ViewportChangeHookParams = {
|
|
25
25
|
transform: GraphTransformOptions;
|
|
26
26
|
effectTiming?: Partial<CameraAnimationOptions>;
|
|
27
|
+
tileLodSize?: number;
|
|
27
28
|
};
|
|
28
29
|
|
|
29
30
|
export interface Hooks {
|
|
@@ -53,6 +54,10 @@ export interface Hooks {
|
|
|
53
54
|
graphCore: GraphCore;
|
|
54
55
|
theme: ThemeSpecification;
|
|
55
56
|
transientCanvas: Canvas;
|
|
57
|
+
tileOptimize?: {
|
|
58
|
+
tileFirstRender?: boolean | number;
|
|
59
|
+
tileFirstRenderSize?: number;
|
|
60
|
+
};
|
|
56
61
|
}>; // TODO: define param template
|
|
57
62
|
layout: IHook<{
|
|
58
63
|
graphCore: GraphCore;
|
|
@@ -82,6 +87,7 @@ export interface Hooks {
|
|
|
82
87
|
action?: string;
|
|
83
88
|
enableStack?: boolean;
|
|
84
89
|
changes?: any;
|
|
90
|
+
keepKeyShape?: boolean;
|
|
85
91
|
}>;
|
|
86
92
|
itemzindexchange: IHook<{
|
|
87
93
|
ids: ID[];
|
package/src/types/item.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
Group,
|
|
14
14
|
DisplayObject,
|
|
15
15
|
IAnimation,
|
|
16
|
+
Shape,
|
|
16
17
|
} from '@antv/g';
|
|
17
18
|
import {
|
|
18
19
|
CubeGeometryProps,
|
|
@@ -61,11 +62,20 @@ export type GShapeStyle = CircleStyleProps &
|
|
|
61
62
|
interactive?: boolean;
|
|
62
63
|
};
|
|
63
64
|
|
|
65
|
+
export type ClipCfg = {
|
|
66
|
+
type: SHAPE_TYPE;
|
|
67
|
+
show: boolean;
|
|
68
|
+
} & CircleStyleProps &
|
|
69
|
+
RectStyleProps &
|
|
70
|
+
EllipseStyleProps;
|
|
71
|
+
|
|
64
72
|
export type ShapeStyle = Partial<
|
|
65
73
|
GShapeStyle & {
|
|
66
74
|
animates?: IAnimates;
|
|
67
75
|
lod?: number;
|
|
68
76
|
visible?: boolean;
|
|
77
|
+
} & {
|
|
78
|
+
clipCfg?: ClipCfg;
|
|
69
79
|
}
|
|
70
80
|
>;
|
|
71
81
|
export interface Encode<T> {
|
package/src/types/spec.ts
CHANGED
|
@@ -47,6 +47,19 @@ export interface Specification<
|
|
|
47
47
|
headless: boolean;
|
|
48
48
|
};
|
|
49
49
|
zoom?: number;
|
|
50
|
+
/** Global optimize configuration. */
|
|
51
|
+
optimize?: {
|
|
52
|
+
/** Whether enable tile rendering for first time. */
|
|
53
|
+
tileFirstRender?: boolean | number;
|
|
54
|
+
/** Tile size for first rendering. */
|
|
55
|
+
tileFirstRenderSize?: number;
|
|
56
|
+
/** Whether enable tile hiding / showing for behaivors, e.g. hiding shapes while drag-canvas, zoom-canvas. The enableOptimize in behavior configuration has higher priority. */
|
|
57
|
+
tileBehavior?: boolean | number;
|
|
58
|
+
/** Tile size for shape optimizing by behaviors, e.g. hiding shapes while drag-canvas, zoom-canvas. The enableOptimize in behavior configuration has higher priority. */
|
|
59
|
+
tileBehaviorSize?: number;
|
|
60
|
+
/** Tile size for level of detial changing. */
|
|
61
|
+
tileLodSize?: number;
|
|
62
|
+
};
|
|
50
63
|
autoFit?:
|
|
51
64
|
| 'view'
|
|
52
65
|
| 'center'
|
package/src/util/bbox.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable prefer-spread */
|
|
2
2
|
import { AABB } from '@antv/g';
|
|
3
|
-
import { PolyPoint } from 'types/common';
|
|
3
|
+
import { Point, PolyPoint } from 'types/common';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Retrieve the width of a bounding box
|
|
@@ -296,3 +296,40 @@ export const isSegmentCrossingBBox = (
|
|
|
296
296
|
}
|
|
297
297
|
return false;
|
|
298
298
|
};
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
Determines whether a given point is inside a given bounding box.
|
|
302
|
+
@param {Point} point - The point to be checked.
|
|
303
|
+
@param {AABB} bbox - The bounding box.
|
|
304
|
+
@returns {boolean} - Returns true if the point is inside the bounding box, false otherwise.
|
|
305
|
+
*/
|
|
306
|
+
export const isPointInBBox = (point: Point, bbox: AABB) => {
|
|
307
|
+
const { x, y } = point;
|
|
308
|
+
return (
|
|
309
|
+
x > bbox.min[0] && x < bbox.max[0] && y > bbox.min[1] && y < bbox.max[1]
|
|
310
|
+
);
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
Determines whether a given sub-bounding box is fully contained within a given bounding box.
|
|
315
|
+
@param {AABB} subBBox - The sub-bounding box to be checked.
|
|
316
|
+
@param {AABB} bbox - The bounding box.
|
|
317
|
+
@param {number} [scale] - Optional scaling factor to adjust the size of the bounding box.
|
|
318
|
+
@returns {boolean} - Returns true if the sub-bounding box is fully contained within the bounding box, false otherwise.
|
|
319
|
+
*/
|
|
320
|
+
export const isBBoxInBBox = (subBBox: AABB, bbox: AABB, scale?: number) => {
|
|
321
|
+
if (scale) {
|
|
322
|
+
return (
|
|
323
|
+
subBBox.min[0] > bbox.min[0] - bbox.halfExtents[0] * scale &&
|
|
324
|
+
subBBox.max[0] < bbox.max[0] + bbox.halfExtents[0] * scale &&
|
|
325
|
+
subBBox.min[1] > bbox.min[1] - bbox.halfExtents[1] * scale &&
|
|
326
|
+
subBBox.max[1] < bbox.max[1] + bbox.halfExtents[1] * scale
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
return (
|
|
330
|
+
subBBox.min[0] > bbox.min[0] &&
|
|
331
|
+
subBBox.max[0] < bbox.max[0] &&
|
|
332
|
+
subBBox.min[1] > bbox.min[1] &&
|
|
333
|
+
subBBox.max[1] < bbox.max[1]
|
|
334
|
+
);
|
|
335
|
+
};
|
package/src/util/shape.ts
CHANGED
|
@@ -218,13 +218,13 @@ export const updateShapes = (
|
|
|
218
218
|
if (prevShape !== newShape) {
|
|
219
219
|
prevShape.remove();
|
|
220
220
|
}
|
|
221
|
-
if (newShape.style.display !== 'none') {
|
|
221
|
+
if (!newShape.destroyed && newShape.style.display !== 'none') {
|
|
222
222
|
group.appendChild(newShape);
|
|
223
223
|
}
|
|
224
224
|
} else if (!prevShape && newShape) {
|
|
225
225
|
// add newShapeMap - prevShapeMap
|
|
226
226
|
finalShapeMap[id] = newShape;
|
|
227
|
-
if (newShape.style.display !== 'none') {
|
|
227
|
+
if (!newShape.destroyed && newShape.style.display !== 'none') {
|
|
228
228
|
group.appendChild(newShape);
|
|
229
229
|
}
|
|
230
230
|
} else if (prevShape && !newShape && removeDiff) {
|