@deck.gl-community/graph-layers 9.1.0-beta.8 → 9.2.0-beta.2
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/LICENSE +1 -1
- package/dist/_deprecated/old-constants.d.ts +107 -0
- package/dist/_deprecated/old-constants.d.ts.map +1 -0
- package/dist/_deprecated/old-constants.js +111 -0
- package/dist/_deprecated/old-constants.js.map +1 -0
- package/dist/core/cache.d.ts +0 -1
- package/dist/core/cache.js +0 -1
- package/dist/core/constants.d.ts +12 -100
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.js +3 -44
- package/dist/core/constants.js.map +1 -1
- package/dist/core/graph-engine.d.ts +12 -11
- package/dist/core/graph-engine.d.ts.map +1 -1
- package/dist/core/graph-engine.js +22 -11
- package/dist/core/graph-engine.js.map +1 -1
- package/dist/core/graph-layout.d.ts +48 -21
- package/dist/core/graph-layout.d.ts.map +1 -1
- package/dist/core/graph-layout.js +91 -24
- package/dist/core/graph-layout.js.map +1 -1
- package/dist/core/interaction-manager.d.ts +6 -4
- package/dist/core/interaction-manager.d.ts.map +1 -1
- package/dist/core/interaction-manager.js +59 -17
- package/dist/core/interaction-manager.js.map +1 -1
- package/dist/graph/edge.d.ts +7 -7
- package/dist/graph/edge.d.ts.map +1 -1
- package/dist/graph/edge.js +3 -6
- package/dist/graph/edge.js.map +1 -1
- package/dist/graph/graph.d.ts +2 -3
- package/dist/graph/graph.js +8 -9
- package/dist/graph/graph.js.map +1 -1
- package/dist/graph/node.d.ts +7 -8
- package/dist/graph/node.d.ts.map +1 -1
- package/dist/graph/node.js +3 -5
- package/dist/graph/node.js.map +1 -1
- package/dist/graph-style-schema.cdn.d.ts +2 -0
- package/dist/graph-style-schema.cdn.js +2 -0
- package/dist/graph-style-schema.json +12 -0
- package/dist/index.cjs +2821 -549
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +28 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -21
- package/dist/index.js.map +1 -1
- package/dist/layers/common-layers/flow-path-layer/flow-path-layer-fragment.glsl.d.ts +0 -1
- package/dist/layers/common-layers/flow-path-layer/flow-path-layer-fragment.glsl.js +0 -1
- package/dist/layers/common-layers/flow-path-layer/flow-path-layer-vertex-tf.glsl.d.ts +0 -1
- package/dist/layers/common-layers/flow-path-layer/flow-path-layer-vertex-tf.glsl.js +0 -1
- package/dist/layers/common-layers/flow-path-layer/flow-path-layer-vertex.glsl.d.ts +0 -1
- package/dist/layers/common-layers/flow-path-layer/flow-path-layer-vertex.glsl.js +0 -1
- package/dist/layers/common-layers/flow-path-layer/flow-path-layer.d.ts +0 -1
- package/dist/layers/common-layers/flow-path-layer/flow-path-layer.js +0 -1
- package/dist/layers/common-layers/marker-layer/atlas-data-url.d.ts +0 -1
- package/dist/layers/common-layers/marker-layer/atlas-data-url.js +0 -1
- package/dist/layers/common-layers/marker-layer/marker-layer.d.ts +0 -1
- package/dist/layers/common-layers/marker-layer/marker-layer.js +2 -3
- package/dist/layers/common-layers/marker-layer/marker-list.d.ts +2 -63
- package/dist/layers/common-layers/marker-layer/marker-list.d.ts.map +1 -1
- package/dist/layers/common-layers/marker-layer/marker-list.js +1 -65
- package/dist/layers/common-layers/marker-layer/marker-list.js.map +1 -1
- package/dist/layers/common-layers/marker-layer/marker-mapping.d.ts +0 -1
- package/dist/layers/common-layers/marker-layer/marker-mapping.js +0 -1
- package/dist/layers/common-layers/spline-layer/spline-layer.d.ts +0 -1
- package/dist/layers/common-layers/spline-layer/spline-layer.js +0 -1
- package/dist/layers/common-layers/zoomable-text-layer/zoomable-text-layer.d.ts +0 -1
- package/dist/layers/common-layers/zoomable-text-layer/zoomable-text-layer.js +0 -1
- package/dist/layers/edge-attachment-helper.d.ts +15 -0
- package/dist/layers/edge-attachment-helper.d.ts.map +1 -0
- package/dist/layers/edge-attachment-helper.js +230 -0
- package/dist/layers/edge-attachment-helper.js.map +1 -0
- package/dist/layers/edge-layer.d.ts +1 -5
- package/dist/layers/edge-layer.d.ts.map +1 -1
- package/dist/layers/edge-layer.js +9 -11
- package/dist/layers/edge-layer.js.map +1 -1
- package/dist/layers/edge-layers/arrow-2d-geometry.d.ts +4 -0
- package/dist/layers/edge-layers/arrow-2d-geometry.d.ts.map +1 -0
- package/dist/layers/edge-layers/arrow-2d-geometry.js +42 -0
- package/dist/layers/edge-layers/arrow-2d-geometry.js.map +1 -0
- package/dist/layers/edge-layers/curved-edge-layer.d.ts +1 -2
- package/dist/layers/edge-layers/curved-edge-layer.js +1 -2
- package/dist/layers/edge-layers/edge-arrow-layer.d.ts +21 -0
- package/dist/layers/edge-layers/edge-arrow-layer.d.ts.map +1 -0
- package/dist/layers/edge-layers/edge-arrow-layer.js +131 -0
- package/dist/layers/edge-layers/edge-arrow-layer.js.map +1 -0
- package/dist/layers/edge-layers/edge-label-layer.d.ts +1 -2
- package/dist/layers/edge-layers/edge-label-layer.js +1 -2
- package/dist/layers/edge-layers/flow-layer.d.ts +1 -2
- package/dist/layers/edge-layers/flow-layer.js +1 -2
- package/dist/layers/edge-layers/path-edge-layer.d.ts +0 -1
- package/dist/layers/edge-layers/path-edge-layer.js +0 -1
- package/dist/layers/edge-layers/straight-line-edge-layer.d.ts +0 -1
- package/dist/layers/edge-layers/straight-line-edge-layer.js +0 -1
- package/dist/layers/graph-layer.d.ts +22 -23
- package/dist/layers/graph-layer.d.ts.map +1 -1
- package/dist/layers/graph-layer.js +218 -62
- package/dist/layers/graph-layer.js.map +1 -1
- package/dist/layers/node-layers/circle-layer.d.ts +0 -1
- package/dist/layers/node-layers/circle-layer.js +0 -1
- package/dist/layers/node-layers/image-layer.d.ts +0 -1
- package/dist/layers/node-layers/image-layer.js +0 -1
- package/dist/layers/node-layers/label-layer.d.ts +1 -2
- package/dist/layers/node-layers/label-layer.js +1 -2
- package/dist/layers/node-layers/path-rounded-rectangle-layer.d.ts +0 -1
- package/dist/layers/node-layers/path-rounded-rectangle-layer.js +1 -2
- package/dist/layers/node-layers/rectangle-layer.d.ts +0 -1
- package/dist/layers/node-layers/rectangle-layer.js +0 -1
- package/dist/layers/node-layers/rounded-rectangle-layer-fragment.d.ts +0 -1
- package/dist/layers/node-layers/rounded-rectangle-layer-fragment.js +0 -1
- package/dist/layers/node-layers/rounded-rectangle-layer.d.ts +1 -2
- package/dist/layers/node-layers/rounded-rectangle-layer.js +2 -3
- package/dist/layers/node-layers/zoomable-marker-layer.d.ts +1 -2
- package/dist/layers/node-layers/zoomable-marker-layer.js +1 -2
- package/dist/layouts/d3-dag/d3-dag-layout.d.ts +117 -0
- package/dist/layouts/d3-dag/d3-dag-layout.d.ts.map +1 -0
- package/dist/layouts/d3-dag/d3-dag-layout.js +716 -0
- package/dist/layouts/d3-dag/d3-dag-layout.js.map +1 -0
- package/dist/layouts/d3-force/d3-force-layout.d.ts +4 -4
- package/dist/layouts/d3-force/d3-force-layout.d.ts.map +1 -1
- package/dist/layouts/d3-force/d3-force-layout.js +25 -10
- package/dist/layouts/d3-force/d3-force-layout.js.map +1 -1
- package/dist/layouts/d3-force/worker.d.ts +0 -1
- package/dist/layouts/d3-force/worker.js +0 -1
- package/dist/layouts/experimental/force-multi-graph-layout.d.ts +9 -8
- package/dist/layouts/experimental/force-multi-graph-layout.d.ts.map +1 -1
- package/dist/layouts/experimental/force-multi-graph-layout.js +15 -11
- package/dist/layouts/experimental/force-multi-graph-layout.js.map +1 -1
- package/dist/layouts/experimental/hive-plot-layout.d.ts +11 -8
- package/dist/layouts/experimental/hive-plot-layout.d.ts.map +1 -1
- package/dist/layouts/experimental/hive-plot-layout.js +12 -7
- package/dist/layouts/experimental/hive-plot-layout.js.map +1 -1
- package/dist/layouts/experimental/radial-layout.d.ts +10 -7
- package/dist/layouts/experimental/radial-layout.d.ts.map +1 -1
- package/dist/layouts/experimental/radial-layout.js +11 -6
- package/dist/layouts/experimental/radial-layout.js.map +1 -1
- package/dist/layouts/gpu-force/gpu-force-layout.d.ts +4 -4
- package/dist/layouts/gpu-force/gpu-force-layout.d.ts.map +1 -1
- package/dist/layouts/gpu-force/gpu-force-layout.js +18 -9
- package/dist/layouts/gpu-force/gpu-force-layout.js.map +1 -1
- package/dist/layouts/gpu-force/worker.d.ts +0 -1
- package/dist/layouts/gpu-force/worker.js +0 -1
- package/dist/layouts/simple-layout.d.ts +19 -12
- package/dist/layouts/simple-layout.d.ts.map +1 -1
- package/dist/layouts/simple-layout.js +26 -15
- package/dist/layouts/simple-layout.js.map +1 -1
- package/dist/loaders/create-graph.d.ts +1 -2
- package/dist/loaders/create-graph.js +3 -4
- package/dist/loaders/edge-parsers.d.ts +1 -2
- package/dist/loaders/edge-parsers.js +2 -3
- package/dist/loaders/edge-parsers.js.map +1 -1
- package/dist/loaders/json-loader.d.ts +2 -3
- package/dist/loaders/json-loader.d.ts.map +1 -1
- package/dist/loaders/json-loader.js +5 -6
- package/dist/loaders/json-loader.js.map +1 -1
- package/dist/loaders/node-parsers.d.ts +1 -2
- package/dist/loaders/node-parsers.js +2 -3
- package/dist/loaders/node-parsers.js.map +1 -1
- package/dist/loaders/simple-json-graph-loader.d.ts +0 -1
- package/dist/loaders/simple-json-graph-loader.d.ts.map +1 -1
- package/dist/loaders/simple-json-graph-loader.js +5 -6
- package/dist/loaders/simple-json-graph-loader.js.map +1 -1
- package/dist/loaders/table-graph-loader.d.ts +3 -4
- package/dist/loaders/table-graph-loader.js +5 -6
- package/dist/loaders/table-graph-loader.js.map +1 -1
- package/dist/style/graph-layer-stylesheet.d.ts +34 -0
- package/dist/style/graph-layer-stylesheet.d.ts.map +1 -0
- package/dist/style/graph-layer-stylesheet.js +39 -0
- package/dist/style/graph-layer-stylesheet.js.map +1 -0
- package/dist/style/graph-style-accessor-map.d.ts +93 -0
- package/dist/style/graph-style-accessor-map.d.ts.map +1 -0
- package/dist/style/graph-style-accessor-map.js +93 -0
- package/dist/style/graph-style-accessor-map.js.map +1 -0
- package/dist/style/graph-style-engine.d.ts +10 -0
- package/dist/style/graph-style-engine.d.ts.map +1 -0
- package/dist/style/graph-style-engine.js +163 -0
- package/dist/style/graph-style-engine.js.map +1 -0
- package/dist/style/graph-stylesheet.schema.d.ts +310 -0
- package/dist/style/graph-stylesheet.schema.d.ts.map +1 -0
- package/dist/style/graph-stylesheet.schema.js +237 -0
- package/dist/style/graph-stylesheet.schema.js.map +1 -0
- package/dist/style/style-engine.d.ts +33 -0
- package/dist/style/style-engine.d.ts.map +1 -0
- package/dist/style/style-engine.js +121 -0
- package/dist/style/style-engine.js.map +1 -0
- package/dist/style/style-property.d.ts +2 -3
- package/dist/style/style-property.d.ts.map +1 -1
- package/dist/style/style-property.js +224 -48
- package/dist/style/style-property.js.map +1 -1
- package/dist/utils/collapsed-chains.d.ts +17 -0
- package/dist/utils/collapsed-chains.d.ts.map +1 -0
- package/dist/utils/collapsed-chains.js +197 -0
- package/dist/utils/collapsed-chains.js.map +1 -0
- package/dist/utils/layer-utils.d.ts +0 -1
- package/dist/utils/layer-utils.d.ts.map +1 -1
- package/dist/utils/layer-utils.js +0 -1
- package/dist/utils/log.d.ts +2 -1
- package/dist/utils/log.d.ts.map +1 -1
- package/dist/utils/log.js +12 -2
- package/dist/utils/log.js.map +1 -1
- package/dist/utils/node-boundary.d.ts +10 -0
- package/dist/utils/node-boundary.d.ts.map +1 -0
- package/dist/utils/node-boundary.js +130 -0
- package/dist/utils/node-boundary.js.map +1 -0
- package/dist/utils/polygon-calculations.d.ts +0 -1
- package/dist/utils/polygon-calculations.js +0 -1
- package/dist/widgets/long-press-button.d.ts +0 -1
- package/dist/widgets/long-press-button.js +0 -1
- package/dist/widgets/view-control-widget.d.ts +4 -5
- package/dist/widgets/view-control-widget.d.ts.map +1 -1
- package/dist/widgets/view-control-widget.js +10 -8
- package/dist/widgets/view-control-widget.js.map +1 -1
- package/package.json +23 -7
- package/src/_deprecated/old-constants.ts +122 -0
- package/src/core/constants.ts +21 -43
- package/src/core/graph-engine.ts +24 -9
- package/src/core/graph-layout.ts +133 -28
- package/src/core/interaction-manager.ts +80 -20
- package/src/graph/edge.ts +6 -6
- package/src/graph/graph.ts +7 -7
- package/src/graph/node.ts +6 -6
- package/src/index.ts +31 -6
- package/src/layers/common-layers/marker-layer/marker-list.ts +62 -64
- package/src/layers/edge-attachment-helper.ts +355 -0
- package/src/layers/edge-layer.ts +6 -7
- package/src/layers/edge-layers/arrow-2d-geometry.ts +51 -0
- package/src/layers/edge-layers/edge-arrow-layer.ts +171 -0
- package/src/layers/graph-layer.ts +304 -86
- package/src/layouts/d3-dag/d3-dag-layout.ts +969 -0
- package/src/layouts/d3-force/d3-force-layout.ts +33 -11
- package/src/layouts/experimental/force-multi-graph-layout.ts +22 -13
- package/src/layouts/experimental/hive-plot-layout.ts +22 -10
- package/src/layouts/experimental/radial-layout.ts +20 -8
- package/src/layouts/gpu-force/gpu-force-layout.ts +22 -10
- package/src/layouts/simple-layout.ts +48 -25
- package/src/loaders/edge-parsers.ts +2 -2
- package/src/loaders/json-loader.ts +2 -2
- package/src/loaders/node-parsers.ts +2 -2
- package/src/loaders/simple-json-graph-loader.ts +2 -2
- package/src/loaders/table-graph-loader.ts +2 -2
- package/src/style/graph-layer-stylesheet.ts +99 -0
- package/src/style/graph-style-accessor-map.ts +103 -0
- package/src/style/graph-style-engine.ts +229 -0
- package/src/style/graph-stylesheet.schema.ts +344 -0
- package/src/style/style-engine.ts +168 -0
- package/src/style/style-property.ts +314 -51
- package/src/utils/collapsed-chains.ts +261 -0
- package/src/utils/log.ts +15 -1
- package/src/utils/node-boundary.ts +238 -0
- package/src/widgets/view-control-widget.tsx +15 -13
- package/dist/style/style-sheet.d.ts +0 -11
- package/dist/style/style-sheet.d.ts.map +0 -1
- package/dist/style/style-sheet.js +0 -253
- package/dist/style/style-sheet.js.map +0 -1
- package/src/style/style-sheet.ts +0 -277
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deck.gl-community/graph-layers",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.0-beta.2",
|
|
4
4
|
"description": "WebGL2-Powered library for Graph Visualization",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"graph",
|
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
20
20
|
"require": "./dist/index.cjs",
|
|
21
21
|
"import": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./graph-style-schema.json": "./dist/graph-style-schema.json",
|
|
24
|
+
"./graph-style-schema.cdn": {
|
|
25
|
+
"types": "./dist/graph-style-schema.cdn.d.ts",
|
|
26
|
+
"default": "./dist/graph-style-schema.cdn.js"
|
|
22
27
|
}
|
|
23
28
|
},
|
|
24
29
|
"files": [
|
|
@@ -26,21 +31,27 @@
|
|
|
26
31
|
"src"
|
|
27
32
|
],
|
|
28
33
|
"scripts": {
|
|
34
|
+
"build": "tsc -b tsconfig.json && node ./scripts/generate-graphstyle-schema.mjs",
|
|
35
|
+
"build:schema": "node ./scripts/generate-graphstyle-schema.mjs",
|
|
29
36
|
"test": "vitest run",
|
|
30
37
|
"test-watch": "vitest"
|
|
31
38
|
},
|
|
32
39
|
"license": "MIT",
|
|
33
40
|
"dependencies": {
|
|
34
|
-
"@deck.gl/core": "
|
|
35
|
-
"@deck.gl/layers": "
|
|
36
|
-
"@deck.gl/widgets": "
|
|
37
|
-
"@
|
|
41
|
+
"@deck.gl/core": "~9.2.1",
|
|
42
|
+
"@deck.gl/layers": "~9.2.1",
|
|
43
|
+
"@deck.gl/widgets": "~9.2.1",
|
|
44
|
+
"@loaders.gl/core": "^4.2.0",
|
|
45
|
+
"@luma.gl/core": "~9.2.0",
|
|
46
|
+
"@luma.gl/engine": "~9.2.0",
|
|
47
|
+
"@luma.gl/shadertools": "~9.2.0",
|
|
38
48
|
"@probe.gl/log": "^4.0.4",
|
|
39
49
|
"cardinal-spline-js": "^2.3.10",
|
|
40
50
|
"color": "^4.2.3",
|
|
41
51
|
"core-js": "^3.29.0",
|
|
42
52
|
"d3": "^7.8.2",
|
|
43
53
|
"d3-array": "^3.2.2",
|
|
54
|
+
"d3-dag": "^1.1.0",
|
|
44
55
|
"d3-force": "^3.0.0",
|
|
45
56
|
"d3-format": "^3.1.0",
|
|
46
57
|
"d3-scale": "^4.0.2",
|
|
@@ -51,7 +62,12 @@
|
|
|
51
62
|
"raf": "^3.4.1"
|
|
52
63
|
},
|
|
53
64
|
"devDependencies": {
|
|
54
|
-
"ngraph.generators": "^20.1.0"
|
|
65
|
+
"ngraph.generators": "^20.1.0",
|
|
66
|
+
"zod": "^4.0.0",
|
|
67
|
+
"zod-to-json-schema": "^3.22.5"
|
|
55
68
|
},
|
|
56
|
-
"
|
|
69
|
+
"peerDependencies": {
|
|
70
|
+
"zod": "^3.23.8 || ^4.0.0"
|
|
71
|
+
},
|
|
72
|
+
"gitHead": "b434bcba10800f27e95a7c9e6c4c7edd0b915773"
|
|
57
73
|
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {EdgeDecoratorType, EdgeState, EdgeType, LayoutState, NodeState, NodeType} from '../core/constants';
|
|
6
|
+
import {Marker} from '../layers/common-layers/marker-layer/marker-list';
|
|
7
|
+
|
|
8
|
+
/** Markers supported by graph-layers @deprecated v9.2: Use string literals */
|
|
9
|
+
export const MARKER_TYPE = {
|
|
10
|
+
'bell-filled': 'bell-filled',
|
|
11
|
+
bell: 'bell',
|
|
12
|
+
'bookmark-filled': 'bookmark-filled',
|
|
13
|
+
bookmark: 'bookmark',
|
|
14
|
+
'cd-filled': 'cd-filled',
|
|
15
|
+
cd: 'cd',
|
|
16
|
+
checkmark: 'checkmark',
|
|
17
|
+
'circle-check-filled': 'circle-check-filled',
|
|
18
|
+
'circle-check': 'circle-check',
|
|
19
|
+
'circle-filled': 'circle-filled',
|
|
20
|
+
'circle-i-filled': 'circle-i-filled',
|
|
21
|
+
'circle-i': 'circle-i',
|
|
22
|
+
'circle-minus-filled': 'circle-minus-filled',
|
|
23
|
+
'circle-minus': 'circle-minus',
|
|
24
|
+
'circle-plus-filled': 'circle-plus-filled',
|
|
25
|
+
'circle-plus': 'circle-plus',
|
|
26
|
+
'circle-questionmark-filled': 'circle-questionmark-filled',
|
|
27
|
+
'circle-questionmark': 'circle-questionmark',
|
|
28
|
+
'circle-slash-filled': 'circle-slash-filled',
|
|
29
|
+
'circle-slash': 'circle-slash',
|
|
30
|
+
'circle-x-filled': 'circle-x-filled',
|
|
31
|
+
'circle-x': 'circle-x',
|
|
32
|
+
circle: 'circle',
|
|
33
|
+
'diamond-filled': 'diamond-filled',
|
|
34
|
+
diamond: 'diamond',
|
|
35
|
+
'flag-filled': 'flag-filled',
|
|
36
|
+
flag: 'flag',
|
|
37
|
+
gear: 'gear',
|
|
38
|
+
'heart-filled': 'heart-filled',
|
|
39
|
+
heart: 'heart',
|
|
40
|
+
'location-marker-filled': 'location-marker-filled',
|
|
41
|
+
'location-marker': 'location-marker',
|
|
42
|
+
'octagonal-star-filled': 'octagonal-star-filled',
|
|
43
|
+
'octagonal-star': 'octagonal-star',
|
|
44
|
+
'person-filled': 'person-filled',
|
|
45
|
+
person: 'person',
|
|
46
|
+
'pin-filled': 'pin-filled',
|
|
47
|
+
pin: 'pin',
|
|
48
|
+
'plus-small': 'plus-small',
|
|
49
|
+
plus: 'plus',
|
|
50
|
+
'rectangle-filled': 'rectangle-filled',
|
|
51
|
+
rectangle: 'rectangle',
|
|
52
|
+
'star-filled': 'star-filled',
|
|
53
|
+
star: 'star',
|
|
54
|
+
'tag-filled': 'tag-filled',
|
|
55
|
+
tag: 'tag',
|
|
56
|
+
'thumb-down-filled': 'thumb-down-filled',
|
|
57
|
+
'thumb-down': 'thumb-down',
|
|
58
|
+
'thumb-up': 'thumb-up',
|
|
59
|
+
'thumb_up-filled': 'thumb_up-filled',
|
|
60
|
+
'triangle-down-filled': 'triangle-down-filled',
|
|
61
|
+
'triangle-down': 'triangle-down',
|
|
62
|
+
'triangle-left-filled': 'triangle-left-filled',
|
|
63
|
+
'triangle-left': 'triangle-left',
|
|
64
|
+
'triangle-right-filled': 'triangle-right-filled',
|
|
65
|
+
'triangle-right': 'triangle-right',
|
|
66
|
+
'triangle-up-filled': 'triangle-up-filled',
|
|
67
|
+
'triangle-up': 'triangle-up',
|
|
68
|
+
'x-small': 'x-small',
|
|
69
|
+
x: 'x'
|
|
70
|
+
} as const satisfies Record<Marker, Marker>;
|
|
71
|
+
/* eslint-enable */
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
/** The interaction state of a node. @deprecated v9.2: Use string literals */
|
|
75
|
+
export const NODE_STATE = {
|
|
76
|
+
DEFAULT: 'default',
|
|
77
|
+
HOVER: 'hover',
|
|
78
|
+
DRAGGING: 'dragging',
|
|
79
|
+
SELECTED: 'selected'
|
|
80
|
+
} as const satisfies Record<string, NodeState>;
|
|
81
|
+
|
|
82
|
+
/** The interaction state of an edge. @deprecated v9.2: Use string literals */
|
|
83
|
+
export const EDGE_STATE = {
|
|
84
|
+
DEFAULT: 'default',
|
|
85
|
+
HOVER: 'hover',
|
|
86
|
+
DRAGGING: 'dragging',
|
|
87
|
+
SELECTED: 'selected'
|
|
88
|
+
} as const satisfies Record<string, EdgeState>;
|
|
89
|
+
|
|
90
|
+
/** The visual type of a node. @deprecated v9.2: Use string literals */
|
|
91
|
+
export const NODE_TYPE = {
|
|
92
|
+
CIRCLE: 'circle',
|
|
93
|
+
RECTANGLE: 'rectangle',
|
|
94
|
+
ROUNDED_RECTANGLE: 'rounded-rectangle',
|
|
95
|
+
PATH_ROUNDED_RECTANGLE: 'path-rounded-rectangle',
|
|
96
|
+
ICON: 'icon',
|
|
97
|
+
LABEL: 'label',
|
|
98
|
+
MARKER: 'marker'
|
|
99
|
+
} as const satisfies Record<string, NodeType> ;
|
|
100
|
+
|
|
101
|
+
/** The visual type of an edge. @deprecated v9.2: Use string literals */
|
|
102
|
+
export const EDGE_TYPE = {
|
|
103
|
+
SPLINE_CURVE: 'spline',
|
|
104
|
+
LINE: 'line',
|
|
105
|
+
PATH: 'path'
|
|
106
|
+
} as const satisfies Record<string, EdgeType> ;
|
|
107
|
+
|
|
108
|
+
/** Decorators on an edge. @deprecated v9.2: Use string literals */
|
|
109
|
+
export const EDGE_DECORATOR_TYPE = {
|
|
110
|
+
LABEL: 'label',
|
|
111
|
+
FLOW: 'flow',
|
|
112
|
+
ARROW: 'arrow'
|
|
113
|
+
} as const satisfies Record<string, EdgeDecoratorType> ;
|
|
114
|
+
|
|
115
|
+
/** the status of the layout. @deprecated v9.2: Use string literals */
|
|
116
|
+
export const LAYOUT_STATE = {
|
|
117
|
+
INIT: 'init',
|
|
118
|
+
START: 'start',
|
|
119
|
+
CALCULATING: 'calculating',
|
|
120
|
+
DONE: 'done',
|
|
121
|
+
ERROR: 'error'
|
|
122
|
+
} as const satisfies Record<string, LayoutState> ;
|
package/src/core/constants.ts
CHANGED
|
@@ -2,57 +2,35 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export {Marker} from '../layers/common-layers/marker-layer/marker-list';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
export
|
|
7
|
+
/** The interaction state of a node. */
|
|
8
|
+
export type NodeState = 'default' | 'hover' | 'dragging' | 'selected';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// the interaction state of a node.
|
|
13
|
-
export const NODE_STATE = {
|
|
14
|
-
DEFAULT: 'default',
|
|
15
|
-
HOVER: 'hover',
|
|
16
|
-
DRAGGING: 'dragging',
|
|
17
|
-
SELECTED: 'selected'
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const EDGE_STATE = {
|
|
21
|
-
DEFAULT: 'default',
|
|
22
|
-
HOVER: 'hover',
|
|
23
|
-
DRAGGING: 'dragging',
|
|
24
|
-
SELECTED: 'selected'
|
|
25
|
-
};
|
|
10
|
+
/** The interaction state of an edge. */
|
|
11
|
+
export type EdgeState = 'default' | 'hover' | 'dragging' | 'selected';
|
|
26
12
|
|
|
27
13
|
// node visual marker type
|
|
28
|
-
export
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
14
|
+
export type NodeType =
|
|
15
|
+
| 'circle'
|
|
16
|
+
| 'rectangle'
|
|
17
|
+
| 'rounded-rectangle'
|
|
18
|
+
| 'path-rounded-rectangle'
|
|
19
|
+
| 'icon'
|
|
20
|
+
| 'label'
|
|
21
|
+
| 'marker';
|
|
37
22
|
|
|
38
23
|
// edge shape
|
|
24
|
+
export type EdgeType = 'spline' | 'line' | 'path';
|
|
25
|
+
|
|
39
26
|
export const EDGE_TYPE = {
|
|
40
|
-
|
|
41
|
-
LINE: '
|
|
42
|
-
PATH: '
|
|
43
|
-
}
|
|
27
|
+
SPLINE: 'spline',
|
|
28
|
+
LINE: 'line',
|
|
29
|
+
PATH: 'path'
|
|
30
|
+
} as const satisfies Record<string, EdgeType>;
|
|
44
31
|
|
|
45
32
|
// decorators on edges
|
|
46
|
-
export
|
|
47
|
-
LABEL: 'EDGE_LABEL',
|
|
48
|
-
FLOW: 'FLOW'
|
|
49
|
-
};
|
|
33
|
+
export type EdgeDecoratorType = 'label' | 'flow' | 'arrow';
|
|
50
34
|
|
|
51
35
|
// the status of the layout
|
|
52
|
-
export
|
|
53
|
-
INIT: 'INIT',
|
|
54
|
-
START: 'START',
|
|
55
|
-
CALCULATING: 'CALCULATING',
|
|
56
|
-
DONE: 'DONE',
|
|
57
|
-
ERROR: 'ERROR'
|
|
58
|
-
};
|
|
36
|
+
export type LayoutState = 'init' | 'start' | 'calculating' | 'done' | 'error';
|
package/src/core/graph-engine.ts
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
+
import type {Bounds2D} from '@math.gl/types';
|
|
6
|
+
|
|
5
7
|
import type {Node} from '../graph/node';
|
|
6
8
|
import {Edge} from '../graph/edge';
|
|
7
9
|
import {Graph} from '../graph/graph';
|
|
8
|
-
import {GraphLayout} from './graph-layout';
|
|
10
|
+
import {GraphLayout, type GraphLayoutEventDetail} from './graph-layout';
|
|
9
11
|
import {Cache} from './cache';
|
|
12
|
+
import {log} from '../utils/log';
|
|
10
13
|
|
|
11
14
|
export type GraphEngineProps = {
|
|
12
15
|
graph: Graph;
|
|
@@ -69,6 +72,8 @@ export class GraphEngine extends EventTarget {
|
|
|
69
72
|
|
|
70
73
|
getLayoutState = () => this._layout.state;
|
|
71
74
|
|
|
75
|
+
getLayoutBounds = (): Bounds2D | null => this._layout.getBounds();
|
|
76
|
+
|
|
72
77
|
/** Operations on the graph */
|
|
73
78
|
|
|
74
79
|
lockNodePosition = (node, x, y) => this._layout.lockNodePosition(node, x, y);
|
|
@@ -78,45 +83,52 @@ export class GraphEngine extends EventTarget {
|
|
|
78
83
|
/**
|
|
79
84
|
* @fires GraphEngine#onLayoutStart
|
|
80
85
|
*/
|
|
81
|
-
_onLayoutStart = () => {
|
|
86
|
+
_onLayoutStart = (event: Event) => {
|
|
87
|
+
log.log(0, 'GraphEngine: layout start')();
|
|
88
|
+
const detail = event instanceof CustomEvent ? (event.detail as GraphLayoutEventDetail) : undefined;
|
|
82
89
|
/**
|
|
83
90
|
* @event GraphEngine#onLayoutStart
|
|
84
91
|
* @type {CustomEvent}
|
|
85
92
|
*/
|
|
86
|
-
this.dispatchEvent(new CustomEvent('onLayoutStart'));
|
|
93
|
+
this.dispatchEvent(new CustomEvent('onLayoutStart', {detail}));
|
|
87
94
|
};
|
|
88
95
|
|
|
89
96
|
/**
|
|
90
97
|
* @fires GraphEngine#onLayoutChange
|
|
91
98
|
*/
|
|
92
|
-
_onLayoutChange = () => {
|
|
99
|
+
_onLayoutChange = (event: Event) => {
|
|
100
|
+
log.log(0, 'GraphEngine: layout update event')();
|
|
101
|
+
const detail = event instanceof CustomEvent ? (event.detail as GraphLayoutEventDetail) : undefined;
|
|
93
102
|
/**
|
|
94
103
|
* @event GraphEngine#onLayoutChange
|
|
95
104
|
* @type {CustomEvent}
|
|
96
105
|
*/
|
|
97
|
-
this.dispatchEvent(new CustomEvent('onLayoutChange'));
|
|
106
|
+
this.dispatchEvent(new CustomEvent('onLayoutChange', {detail}));
|
|
98
107
|
};
|
|
99
108
|
|
|
100
109
|
/**
|
|
101
110
|
* @fires GraphEngine#onLayoutDone
|
|
102
111
|
*/
|
|
103
|
-
_onLayoutDone = () => {
|
|
112
|
+
_onLayoutDone = (event: Event) => {
|
|
113
|
+
log.log(0, 'GraphEngine: layout end')();
|
|
114
|
+
const detail = event instanceof CustomEvent ? (event.detail as GraphLayoutEventDetail) : undefined;
|
|
104
115
|
/**
|
|
105
116
|
* @event GraphEngine#onLayoutDone
|
|
106
117
|
* @type {CustomEvent}
|
|
107
118
|
*/
|
|
108
|
-
this.dispatchEvent(new CustomEvent('onLayoutDone'));
|
|
119
|
+
this.dispatchEvent(new CustomEvent('onLayoutDone', {detail}));
|
|
109
120
|
};
|
|
110
121
|
|
|
111
122
|
/**
|
|
112
123
|
* @fires GraphEngine#onLayoutError
|
|
113
124
|
*/
|
|
114
|
-
_onLayoutError = () => {
|
|
125
|
+
_onLayoutError = (event: Event) => {
|
|
126
|
+
const detail = event instanceof CustomEvent ? event.detail : undefined;
|
|
115
127
|
/**
|
|
116
128
|
* @event GraphEngine#onLayoutError
|
|
117
129
|
* @type {CustomEvent}
|
|
118
130
|
*/
|
|
119
|
-
this.dispatchEvent(new CustomEvent('onLayoutError'));
|
|
131
|
+
this.dispatchEvent(new CustomEvent('onLayoutError', {detail}));
|
|
120
132
|
};
|
|
121
133
|
|
|
122
134
|
_onGraphStructureChanged = (entity) => {
|
|
@@ -136,6 +148,7 @@ export class GraphEngine extends EventTarget {
|
|
|
136
148
|
/** Layout calculations */
|
|
137
149
|
|
|
138
150
|
run = () => {
|
|
151
|
+
log.log(1, 'GraphEngine: run');
|
|
139
152
|
// TODO: throw if running on a cleared engine
|
|
140
153
|
|
|
141
154
|
this._graph.addEventListener('transactionStart', this._onTransactionStart);
|
|
@@ -155,6 +168,7 @@ export class GraphEngine extends EventTarget {
|
|
|
155
168
|
};
|
|
156
169
|
|
|
157
170
|
clear = () => {
|
|
171
|
+
log.log(1, 'GraphEngine: end');
|
|
158
172
|
this._graph.removeEventListener('transactionStart', this._onTransactionStart);
|
|
159
173
|
this._graph.removeEventListener('transactionEnd', this._onTransactionEnd);
|
|
160
174
|
this._graph.removeEventListener('onNodeAdded', this._onGraphStructureChanged);
|
|
@@ -179,6 +193,7 @@ export class GraphEngine extends EventTarget {
|
|
|
179
193
|
};
|
|
180
194
|
|
|
181
195
|
_updateLayout = () => {
|
|
196
|
+
log.log(0, 'GraphEngine: layout update');
|
|
182
197
|
this._layout.updateGraph(this._graph);
|
|
183
198
|
this._layout.update();
|
|
184
199
|
this._layoutDirty = false;
|
package/src/core/graph-layout.ts
CHANGED
|
@@ -2,29 +2,43 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
+
import type {Bounds2D} from '@math.gl/types';
|
|
6
|
+
|
|
5
7
|
import type {Graph} from '../graph/graph';
|
|
6
8
|
import type {Node} from '../graph/node';
|
|
7
9
|
import type {Edge} from '../graph/edge';
|
|
8
10
|
|
|
9
11
|
import isEqual from 'lodash.isequal';
|
|
10
|
-
import {
|
|
12
|
+
import {log} from '../utils/log';
|
|
11
13
|
|
|
12
14
|
// the status of the layout
|
|
13
|
-
export type GraphLayoutState = '
|
|
15
|
+
export type GraphLayoutState = 'init' | 'start' | 'calculating' | 'done' | 'error';
|
|
16
|
+
|
|
17
|
+
export type GraphLayoutEventDetail = {
|
|
18
|
+
bounds: Bounds2D | null;
|
|
19
|
+
};
|
|
14
20
|
|
|
15
|
-
export type
|
|
21
|
+
export type GraphLayoutProps = {};
|
|
16
22
|
|
|
17
23
|
/** All the layout classes are extended from this base layout class. */
|
|
18
|
-
export class GraphLayout<
|
|
19
|
-
OptionsT extends
|
|
24
|
+
export abstract class GraphLayout<
|
|
25
|
+
OptionsT extends GraphLayoutProps = GraphLayoutProps
|
|
20
26
|
> extends EventTarget {
|
|
21
27
|
/** Name of the layout. */
|
|
22
28
|
protected readonly _name: string = 'GraphLayout';
|
|
23
29
|
/** Extra configuration options of the layout. */
|
|
24
30
|
protected _options: OptionsT;
|
|
25
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Last computed layout bounds in local layout coordinates.
|
|
34
|
+
*
|
|
35
|
+
* Subclasses should update this value by overriding {@link _updateBounds}
|
|
36
|
+
* so it reflects the latest geometry before layout lifecycle events fire.
|
|
37
|
+
*/
|
|
38
|
+
protected _bounds: Bounds2D | null = null;
|
|
39
|
+
|
|
26
40
|
public version = 0;
|
|
27
|
-
public state: GraphLayoutState = '
|
|
41
|
+
public state: GraphLayoutState = 'init';
|
|
28
42
|
|
|
29
43
|
/**
|
|
30
44
|
* Constructor of GraphLayout
|
|
@@ -47,28 +61,17 @@ export class GraphLayout<
|
|
|
47
61
|
return this._name === layout._name && isEqual(this._options, layout._options);
|
|
48
62
|
}
|
|
49
63
|
|
|
50
|
-
|
|
64
|
+
// Accessors
|
|
51
65
|
|
|
52
|
-
/** first time to pass the graph data into this layout */
|
|
53
|
-
initializeGraph(graph: Graph) {}
|
|
54
|
-
/** update the existing graph */
|
|
55
|
-
updateGraph(graph: Graph) {}
|
|
56
|
-
/** start the layout calculation */
|
|
57
|
-
start() {}
|
|
58
|
-
/** update the layout calculation */
|
|
59
|
-
update() {}
|
|
60
|
-
/** resume the layout calculation */
|
|
61
|
-
resume() {}
|
|
62
|
-
/** stop the layout calculation */
|
|
63
|
-
stop() {}
|
|
64
66
|
/** access the position of the node in the layout */
|
|
65
67
|
getNodePosition(node: Node): [number, number] {
|
|
66
68
|
return [0, 0];
|
|
67
69
|
}
|
|
70
|
+
|
|
68
71
|
/** access the layout information of the edge */
|
|
69
72
|
getEdgePosition(edge: Edge) {
|
|
70
73
|
return {
|
|
71
|
-
type:
|
|
74
|
+
type: 'line',
|
|
72
75
|
sourcePosition: [0, 0],
|
|
73
76
|
targetPosition: [0, 0],
|
|
74
77
|
controlPoints: []
|
|
@@ -89,52 +92,154 @@ export class GraphLayout<
|
|
|
89
92
|
*/
|
|
90
93
|
unlockNodePosition(node: Node) {}
|
|
91
94
|
|
|
95
|
+
/** Returns the last computed layout bounds, if available. */
|
|
96
|
+
getBounds(): Bounds2D | null {
|
|
97
|
+
return this._bounds;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** virtual functions: will be implemented in the child class */
|
|
101
|
+
|
|
102
|
+
/** first time to pass the graph data into this layout */
|
|
103
|
+
abstract initializeGraph(graph: Graph);
|
|
104
|
+
/** update the existing graph */
|
|
105
|
+
abstract updateGraph(graph: Graph);
|
|
106
|
+
/** start the layout calculation */
|
|
107
|
+
abstract start();
|
|
108
|
+
/** update the layout calculation */
|
|
109
|
+
abstract update();
|
|
110
|
+
/** resume the layout calculation */
|
|
111
|
+
abstract resume();
|
|
112
|
+
/** stop the layout calculation */
|
|
113
|
+
abstract stop();
|
|
114
|
+
|
|
115
|
+
|
|
92
116
|
// INTERNAL METHODS
|
|
93
117
|
|
|
94
|
-
|
|
118
|
+
/** Hook for subclasses to update bounds prior to emitting events. */
|
|
119
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
120
|
+
protected _updateBounds(): void {}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Utility for subclasses to derive layout bounds from an iterable of [x, y] positions.
|
|
124
|
+
* @param positions Iterable of node positions.
|
|
125
|
+
* @returns Layout bounds for the supplied positions or `null` if none are finite.
|
|
126
|
+
*/
|
|
127
|
+
protected _calculateBounds(
|
|
128
|
+
positions: Iterable<Readonly<[number, number]> | null | undefined>
|
|
129
|
+
): Bounds2D | null {
|
|
130
|
+
let minX = Number.POSITIVE_INFINITY;
|
|
131
|
+
let maxX = Number.NEGATIVE_INFINITY;
|
|
132
|
+
let minY = Number.POSITIVE_INFINITY;
|
|
133
|
+
let maxY = Number.NEGATIVE_INFINITY;
|
|
134
|
+
|
|
135
|
+
for (const position of positions) {
|
|
136
|
+
if (!position) {
|
|
137
|
+
// eslint-disable-next-line no-continue
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
const [x, y] = position;
|
|
141
|
+
if (!Number.isFinite(x) || !Number.isFinite(y)) {
|
|
142
|
+
// eslint-disable-next-line no-continue
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
minX = Math.min(minX, x);
|
|
147
|
+
maxX = Math.max(maxX, x);
|
|
148
|
+
minY = Math.min(minY, y);
|
|
149
|
+
maxY = Math.max(maxY, y);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (minX === Number.POSITIVE_INFINITY) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return [
|
|
157
|
+
[minX, minY],
|
|
158
|
+
[maxX, maxY]
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Attempt to coerce an arbitrary value into a finite 2D point.
|
|
164
|
+
* @param value Candidate value that may represent a position.
|
|
165
|
+
* @returns Finite [x, y] tuple or null if the value cannot be interpreted.
|
|
166
|
+
*/
|
|
167
|
+
protected _normalizePosition(value: unknown): [number, number] | null {
|
|
168
|
+
if (Array.isArray(value) && value.length >= 2) {
|
|
169
|
+
const [x, y] = value as [unknown, unknown];
|
|
170
|
+
if (this._isFiniteNumber(x) && this._isFiniteNumber(y)) {
|
|
171
|
+
return [x, y];
|
|
172
|
+
}
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (value && typeof value === 'object') {
|
|
177
|
+
const {x, y} = value as {x?: unknown; y?: unknown};
|
|
178
|
+
if (this._isFiniteNumber(x) && this._isFiniteNumber(y)) {
|
|
179
|
+
return [x, y];
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
private _isFiniteNumber(value: unknown): value is number {
|
|
187
|
+
return typeof value === 'number' && Number.isFinite(value);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
protected _updateState(state: GraphLayoutState) {
|
|
95
191
|
this.state = state;
|
|
96
192
|
this.version += 1;
|
|
97
193
|
}
|
|
98
194
|
|
|
99
195
|
/** @fires GraphLayout#onLayoutStart */
|
|
100
196
|
protected _onLayoutStart = (): void => {
|
|
101
|
-
this.
|
|
197
|
+
log.log(0, `GraphLayout(${this._name}): start`)();
|
|
198
|
+
this._updateBounds();
|
|
199
|
+
this._updateState('calculating');
|
|
102
200
|
|
|
103
201
|
/**
|
|
104
202
|
* Layout calculation start.
|
|
105
203
|
* @event GraphLayout#onLayoutChange
|
|
106
204
|
* @type {CustomEvent}
|
|
107
205
|
*/
|
|
108
|
-
this.
|
|
206
|
+
const detail: GraphLayoutEventDetail = {bounds: this._bounds};
|
|
207
|
+
this.dispatchEvent(new CustomEvent<GraphLayoutEventDetail>('onLayoutStart', {detail}));
|
|
109
208
|
};
|
|
110
209
|
|
|
111
210
|
/** @fires GraphLayout#onLayoutChange */
|
|
112
211
|
protected _onLayoutChange = (): void => {
|
|
113
|
-
this.
|
|
212
|
+
log.log(0, `GraphLayout(${this._name}): update`)();
|
|
213
|
+
this._updateBounds();
|
|
214
|
+
this._updateState('calculating');
|
|
114
215
|
|
|
115
216
|
/**
|
|
116
217
|
* Layout calculation iteration.
|
|
117
218
|
* @event GraphLayout#onLayoutChange
|
|
118
219
|
* @type {CustomEvent}
|
|
119
220
|
*/
|
|
120
|
-
this.
|
|
221
|
+
const detail: GraphLayoutEventDetail = {bounds: this._bounds};
|
|
222
|
+
this.dispatchEvent(new CustomEvent<GraphLayoutEventDetail>('onLayoutChange', {detail}));
|
|
121
223
|
};
|
|
122
224
|
|
|
123
225
|
/** @fires GraphLayout#onLayoutDone */
|
|
124
226
|
protected _onLayoutDone = (): void => {
|
|
125
|
-
this.
|
|
227
|
+
log.log(0, `GraphLayout(${this._name}): end`)();
|
|
228
|
+
this._updateBounds();
|
|
229
|
+
this._updateState('done');
|
|
126
230
|
|
|
127
231
|
/**
|
|
128
232
|
* Layout calculation is done.
|
|
129
233
|
* @event GraphLayout#onLayoutDone
|
|
130
234
|
* @type {CustomEvent}
|
|
131
235
|
*/
|
|
132
|
-
this.
|
|
236
|
+
const detail: GraphLayoutEventDetail = {bounds: this._bounds};
|
|
237
|
+
this.dispatchEvent(new CustomEvent<GraphLayoutEventDetail>('onLayoutDone', {detail}));
|
|
133
238
|
};
|
|
134
239
|
|
|
135
240
|
/** @fires GraphLayout#onLayoutError */
|
|
136
241
|
protected _onLayoutError = (): void => {
|
|
137
|
-
this._updateState('
|
|
242
|
+
this._updateState('error');
|
|
138
243
|
|
|
139
244
|
/**
|
|
140
245
|
* Layout calculation went wrong.
|