@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
package/src/util/animate.ts
CHANGED
|
@@ -6,10 +6,11 @@ import {
|
|
|
6
6
|
Path,
|
|
7
7
|
Polyline,
|
|
8
8
|
} from '@antv/g';
|
|
9
|
+
import { isString, uniq } from '@antv/util';
|
|
9
10
|
import { AnimateTiming, IAnimate, IAnimates } from '../types/animate';
|
|
10
11
|
import { ItemShapeStyles, ShapeStyle } from '../types/item';
|
|
11
12
|
import { isArrayOverlap, replaceElements } from './array';
|
|
12
|
-
import {
|
|
13
|
+
import { cloneJSON } from './data';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Initial(timing = show) shape animation start from init shape styles, and end to the shape's style config.
|
|
@@ -45,6 +46,7 @@ export const getShapeAnimateBeginStyles = (shape) => {
|
|
|
45
46
|
opacity: 0,
|
|
46
47
|
strokeOpacity: 0,
|
|
47
48
|
offsetDistance: 0,
|
|
49
|
+
fill: '#000',
|
|
48
50
|
};
|
|
49
51
|
}
|
|
50
52
|
return {
|
|
@@ -75,7 +77,6 @@ export const DEFAULT_ANIMATE_CFG = {
|
|
|
75
77
|
duration: 500,
|
|
76
78
|
easing: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
|
77
79
|
iterations: 1,
|
|
78
|
-
delay: 1000,
|
|
79
80
|
fill: 'both',
|
|
80
81
|
},
|
|
81
82
|
show: {
|
|
@@ -151,7 +152,8 @@ const groupTimingAnimates = (
|
|
|
151
152
|
*/
|
|
152
153
|
const runAnimateGroupOnShapes = (
|
|
153
154
|
shapeMap: { [shapeId: string]: DisplayObject },
|
|
154
|
-
|
|
155
|
+
shapeIds: string[] = undefined,
|
|
156
|
+
groups: Group[],
|
|
155
157
|
timingAnimates: IAnimate[],
|
|
156
158
|
targetStylesMap: ItemShapeStyles,
|
|
157
159
|
timing: AnimateTiming,
|
|
@@ -163,83 +165,104 @@ const runAnimateGroupOnShapes = (
|
|
|
163
165
|
let maxDurationIdx = -1;
|
|
164
166
|
let hasCanceled = canceled;
|
|
165
167
|
const isOut = timing === 'buildOut' || timing === 'hide';
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
...
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
168
|
+
const shapeIdsToAnimate = shapeIds ? shapeIds : Object.keys(shapeMap);
|
|
169
|
+
const animations = timingAnimates
|
|
170
|
+
.map((animateOptions: any) => {
|
|
171
|
+
const { fields, shapeId, order, states, ...animateCfg } = animateOptions;
|
|
172
|
+
const animateConfig = {
|
|
173
|
+
...DEFAULT_ANIMATE_CFG[timing],
|
|
174
|
+
...animateCfg,
|
|
175
|
+
};
|
|
176
|
+
const { iterations } = animateConfig;
|
|
177
|
+
if (iterations === Infinity && animateCfg.fill == undefined) {
|
|
178
|
+
animateConfig.fill = 'auto';
|
|
179
|
+
}
|
|
176
180
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
});
|
|
187
|
-
const targetStyle =
|
|
188
|
-
targetStylesMap.group || GROUP_ANIMATE_STYLES[isOut ? 0 : 1];
|
|
189
|
-
if (hasCanceled) {
|
|
190
|
-
Object.keys(targetStyle).forEach((key) => {
|
|
191
|
-
group.style[key] = targetStyle[key];
|
|
181
|
+
let animates = [];
|
|
182
|
+
if (!shapeId || shapeId === 'group') {
|
|
183
|
+
// animate on group
|
|
184
|
+
const usingFields = [];
|
|
185
|
+
let hasOpacity = false;
|
|
186
|
+
fields?.forEach((field) => {
|
|
187
|
+
if (field === 'size') usingFields.push('transform');
|
|
188
|
+
else if (field !== 'opacity') usingFields.push(field);
|
|
189
|
+
else hasOpacity = true;
|
|
192
190
|
});
|
|
193
|
-
} else {
|
|
194
|
-
if (hasOpacity) {
|
|
195
|
-
// opacity on group, animate on all shapes
|
|
196
|
-
Object.keys(shapeMap).forEach((shapeId) => {
|
|
197
|
-
const { opacity: targetOpaicty = 1 } =
|
|
198
|
-
targetStylesMap[shapeId] ||
|
|
199
|
-
targetStylesMap.otherShapes?.[shapeId] ||
|
|
200
|
-
{};
|
|
201
|
-
animation = runAnimateOnShape(
|
|
202
|
-
shapeMap[shapeId],
|
|
203
|
-
['opacity'],
|
|
204
|
-
{ opacity: targetOpaicty },
|
|
205
|
-
getShapeAnimateBeginStyles(shapeMap[shapeId]),
|
|
206
|
-
animateConfig,
|
|
207
|
-
);
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
if (usingFields.length) {
|
|
211
|
-
animation = runAnimateOnShape(
|
|
212
|
-
group,
|
|
213
|
-
usingFields,
|
|
214
|
-
targetStyle,
|
|
215
|
-
GROUP_ANIMATE_STYLES[isOut ? 1 : 0],
|
|
216
|
-
animateConfig,
|
|
217
|
-
);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
} else {
|
|
221
|
-
const shape = shapeMap[shapeId];
|
|
222
|
-
if (shape && shape.style.display !== 'none') {
|
|
223
191
|
const targetStyle =
|
|
224
|
-
targetStylesMap[
|
|
225
|
-
targetStylesMap.otherShapes?.[shapeId] ||
|
|
226
|
-
{};
|
|
192
|
+
targetStylesMap.group || GROUP_ANIMATE_STYLES[isOut ? 0 : 1];
|
|
227
193
|
if (hasCanceled) {
|
|
228
194
|
Object.keys(targetStyle).forEach((key) => {
|
|
229
|
-
|
|
195
|
+
groups.forEach((group) => (group.style[key] = targetStyle[key]));
|
|
230
196
|
});
|
|
231
197
|
} else {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
198
|
+
if (hasOpacity) {
|
|
199
|
+
// opacity on group, animate on all shapes
|
|
200
|
+
shapeIdsToAnimate.forEach((sid) => {
|
|
201
|
+
if (!shapeMap[sid]) return;
|
|
202
|
+
const { opacity: targetOpacity = isOut ? 0 : 1 } =
|
|
203
|
+
targetStylesMap[sid] ||
|
|
204
|
+
targetStylesMap.otherShapes?.[sid] ||
|
|
205
|
+
{};
|
|
206
|
+
animates.push(
|
|
207
|
+
runAnimateOnShape(
|
|
208
|
+
shapeMap[sid],
|
|
209
|
+
['opacity'],
|
|
210
|
+
{ opacity: targetOpacity },
|
|
211
|
+
getShapeAnimateBeginStyles(shapeMap[sid]),
|
|
212
|
+
animateConfig,
|
|
213
|
+
),
|
|
214
|
+
);
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
if (usingFields.length) {
|
|
218
|
+
animates = animates.concat(
|
|
219
|
+
groups.map((group) =>
|
|
220
|
+
runAnimateOnShape(
|
|
221
|
+
group,
|
|
222
|
+
usingFields,
|
|
223
|
+
targetStyle,
|
|
224
|
+
GROUP_ANIMATE_STYLES[isOut ? 1 : 0],
|
|
225
|
+
animateConfig,
|
|
226
|
+
),
|
|
227
|
+
),
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
} else {
|
|
232
|
+
const shape = shapeMap[shapeId];
|
|
233
|
+
if (
|
|
234
|
+
shape &&
|
|
235
|
+
shape.style.display !== 'none' &&
|
|
236
|
+
shape.style.visibility !== 'hidden'
|
|
237
|
+
) {
|
|
238
|
+
const targetStyle =
|
|
239
|
+
targetStylesMap[shapeId] ||
|
|
240
|
+
targetStylesMap.otherShapes?.[shapeId] ||
|
|
241
|
+
{};
|
|
242
|
+
if (hasCanceled) {
|
|
243
|
+
Object.keys(targetStyle).forEach((key) => {
|
|
244
|
+
shape.style[key] = targetStyle[key];
|
|
245
|
+
});
|
|
246
|
+
} else {
|
|
247
|
+
animates.push(
|
|
248
|
+
runAnimateOnShape(
|
|
249
|
+
shape,
|
|
250
|
+
fields,
|
|
251
|
+
targetStyle,
|
|
252
|
+
getShapeAnimateBeginStyles(shape),
|
|
253
|
+
animateConfig,
|
|
254
|
+
),
|
|
255
|
+
);
|
|
256
|
+
}
|
|
239
257
|
}
|
|
240
258
|
}
|
|
241
|
-
|
|
242
|
-
|
|
259
|
+
return animates;
|
|
260
|
+
})
|
|
261
|
+
.flat()
|
|
262
|
+
.filter(Boolean);
|
|
263
|
+
animations.forEach((animation, i) => {
|
|
264
|
+
const { duration } = animation.effect.timing;
|
|
265
|
+
if (maxDuration < duration) {
|
|
243
266
|
maxDuration = duration;
|
|
244
267
|
maxDurationIdx = i;
|
|
245
268
|
}
|
|
@@ -249,7 +272,6 @@ const runAnimateGroupOnShapes = (
|
|
|
249
272
|
cancelAnimations();
|
|
250
273
|
};
|
|
251
274
|
}
|
|
252
|
-
return animation;
|
|
253
275
|
});
|
|
254
276
|
if (maxDurationIdx > -1) {
|
|
255
277
|
const selfOnfinish = animations[maxDurationIdx].onfinish;
|
|
@@ -286,10 +308,10 @@ const runAnimateOnShape = (
|
|
|
286
308
|
fields.forEach((key) => {
|
|
287
309
|
animateArr[0][key] =
|
|
288
310
|
shape.style[key] === undefined
|
|
289
|
-
?
|
|
290
|
-
:
|
|
311
|
+
? cloneJSON(beginStyle[key])
|
|
312
|
+
: cloneJSON(shape.style[key]);
|
|
291
313
|
if (targetStyle[key] === undefined) return;
|
|
292
|
-
animateArr[1][key] =
|
|
314
|
+
animateArr[1][key] = cloneJSON(targetStyle[key]);
|
|
293
315
|
if (key === 'lineDash') {
|
|
294
316
|
const beginPercents = uniq(
|
|
295
317
|
animateArr[0][key].filter(
|
|
@@ -302,7 +324,7 @@ const runAnimateOnShape = (
|
|
|
302
324
|
),
|
|
303
325
|
);
|
|
304
326
|
if (beginPercents.length || targetPercents.length) {
|
|
305
|
-
percentLineDash =
|
|
327
|
+
percentLineDash = cloneJSON(animateArr[0].lineDash);
|
|
306
328
|
const totalLength = (
|
|
307
329
|
shape as Line | Polyline | Path
|
|
308
330
|
).getTotalLength();
|
|
@@ -334,6 +356,8 @@ const runAnimateOnShape = (
|
|
|
334
356
|
);
|
|
335
357
|
return;
|
|
336
358
|
}
|
|
359
|
+
if (animateConfig.iterations === -1 || animateConfig.iterations === null)
|
|
360
|
+
animateConfig.iterations = Infinity;
|
|
337
361
|
const animation = shape.animate(animateArr, animateConfig);
|
|
338
362
|
if (percentLineDash) {
|
|
339
363
|
animation.onfinish = () => {
|
|
@@ -384,7 +408,8 @@ export const animateShapes = (
|
|
|
384
408
|
animates: IAnimates,
|
|
385
409
|
mergedStyles: ItemShapeStyles,
|
|
386
410
|
shapeMap: { [shapeId: string]: DisplayObject },
|
|
387
|
-
|
|
411
|
+
shapeIds: string[] = undefined,
|
|
412
|
+
groups: Group[],
|
|
388
413
|
timing: AnimateTiming = 'buildIn',
|
|
389
414
|
changedStates: string[] = [],
|
|
390
415
|
onAnimatesFrame: Function = () => {},
|
|
@@ -413,7 +438,8 @@ export const animateShapes = (
|
|
|
413
438
|
}
|
|
414
439
|
const groupAnimations = runAnimateGroupOnShapes(
|
|
415
440
|
shapeMap,
|
|
416
|
-
|
|
441
|
+
shapeIds,
|
|
442
|
+
groups,
|
|
417
443
|
timingAnimateGroups[groupKeys[i]],
|
|
418
444
|
mergedStyles,
|
|
419
445
|
timing,
|
package/src/util/bbox.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AABB } from '@antv/g';
|
|
1
|
+
import { AABB, Canvas } from '@antv/g';
|
|
2
2
|
import { Point, PolyPoint } from 'types/common';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -332,3 +332,28 @@ export const isBBoxInBBox = (subBBox: AABB, bbox: AABB, scale?: number) => {
|
|
|
332
332
|
subBBox.max[1] < bbox.max[1]
|
|
333
333
|
);
|
|
334
334
|
};
|
|
335
|
+
|
|
336
|
+
export const getCombinedCanvasesBounds = (canvases: Canvas[]) => {
|
|
337
|
+
const combinedBounds = {
|
|
338
|
+
min: [Infinity, Infinity, Infinity],
|
|
339
|
+
max: [-Infinity, -Infinity, -Infinity],
|
|
340
|
+
center: [0, 0, 0],
|
|
341
|
+
halfExtents: [0, 0, 0],
|
|
342
|
+
};
|
|
343
|
+
canvases.forEach((canvas) => {
|
|
344
|
+
const bounds = canvas.document.documentElement.getBounds();
|
|
345
|
+
combinedBounds.min = combinedBounds.min.map((val, i) =>
|
|
346
|
+
Math.min(val || Infinity, bounds.min[i]),
|
|
347
|
+
);
|
|
348
|
+
combinedBounds.max = combinedBounds.max.map((val, i) =>
|
|
349
|
+
Math.max(val || -Infinity, bounds.max[i]),
|
|
350
|
+
);
|
|
351
|
+
});
|
|
352
|
+
combinedBounds.center = combinedBounds.center.map(
|
|
353
|
+
(_, i) => (combinedBounds.max[i] + combinedBounds.min[i]) / 2,
|
|
354
|
+
);
|
|
355
|
+
combinedBounds.halfExtents = combinedBounds.halfExtents.map(
|
|
356
|
+
(_, i) => (combinedBounds.max[i] - combinedBounds.min[i]) / 2,
|
|
357
|
+
);
|
|
358
|
+
return combinedBounds;
|
|
359
|
+
};
|
package/src/util/data.ts
CHANGED
|
@@ -334,18 +334,27 @@ export const dataLifecycleMap: Record<string, string> = {
|
|
|
334
334
|
* @param excludeInvisibles whether exclude invisibles. true means the function should test without visible items.
|
|
335
335
|
* @returns graph is empty or not.
|
|
336
336
|
*/
|
|
337
|
-
export const isEmptyGraph = (graph, excludeInvisibles = false):
|
|
337
|
+
export const isEmptyGraph = (graph, excludeInvisibles = false): boolean => {
|
|
338
338
|
const nodes = graph.getAllNodesData();
|
|
339
339
|
const combos = graph.getAllCombosData();
|
|
340
340
|
if (nodes.length === 0 && combos.length === 0) return true;
|
|
341
341
|
|
|
342
342
|
if (excludeInvisibles) {
|
|
343
343
|
const edges = graph.getAllEdgesData();
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
if (!hasVisibleItems) return true;
|
|
344
|
+
if (nodes.find((node) => graph.getItemVisible(node.id))) return false;
|
|
345
|
+
if (edges.find((edge) => graph.getItemVisible(edge.id))) return false;
|
|
346
|
+
if (combos.find((combo) => graph.getItemVisible(combo.id))) return false;
|
|
347
|
+
return true;
|
|
349
348
|
}
|
|
350
349
|
return false;
|
|
351
350
|
};
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Clone an object by JSON stringify and parse
|
|
354
|
+
* @param obj
|
|
355
|
+
* @returns
|
|
356
|
+
*/
|
|
357
|
+
export const cloneJSON = (obj) => {
|
|
358
|
+
if (!obj) return obj;
|
|
359
|
+
return JSON.parse(JSON.stringify(obj));
|
|
360
|
+
};
|
package/src/util/dom.ts
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* @returns
|
|
5
5
|
*/
|
|
6
6
|
export function createDOM(str: string): HTMLElement {
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const containerDOM = document.createElement('div');
|
|
8
|
+
containerDOM.innerHTML = str;
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
if (dom &&
|
|
12
|
-
|
|
10
|
+
let dom = containerDOM.childNodes[0] as HTMLElement;
|
|
11
|
+
if (dom && containerDOM.contains(dom)) {
|
|
12
|
+
dom = containerDOM.removeChild(dom);
|
|
13
13
|
}
|
|
14
|
-
return dom
|
|
14
|
+
return dom;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
package/src/util/item.ts
CHANGED
|
@@ -32,6 +32,8 @@ export const upsertTransientItem = (
|
|
|
32
32
|
nodeGroup: Group,
|
|
33
33
|
edgeGroup: Group,
|
|
34
34
|
comboGroup: Group,
|
|
35
|
+
nodeLabelGroup: Group,
|
|
36
|
+
edgeLabelGroup: Group,
|
|
35
37
|
transientItemMap: Map<ID, Node | Edge | Combo | Group>,
|
|
36
38
|
itemMap: Map<ID, Node | Edge | Combo>,
|
|
37
39
|
graphCore?: GraphCore,
|
|
@@ -56,7 +58,7 @@ export const upsertTransientItem = (
|
|
|
56
58
|
visible = true,
|
|
57
59
|
} = drawOptions;
|
|
58
60
|
if (item.type === 'node') {
|
|
59
|
-
transientItem = item.clone(nodeGroup, shapeIds, true);
|
|
61
|
+
transientItem = item.clone(nodeGroup, nodeLabelGroup, shapeIds, true);
|
|
60
62
|
} else if (item.type === 'edge') {
|
|
61
63
|
let source;
|
|
62
64
|
let target;
|
|
@@ -66,6 +68,8 @@ export const upsertTransientItem = (
|
|
|
66
68
|
nodeGroup,
|
|
67
69
|
edgeGroup,
|
|
68
70
|
comboGroup,
|
|
71
|
+
nodeLabelGroup,
|
|
72
|
+
edgeLabelGroup,
|
|
69
73
|
transientItemMap,
|
|
70
74
|
itemMap,
|
|
71
75
|
graphCore,
|
|
@@ -79,6 +83,8 @@ export const upsertTransientItem = (
|
|
|
79
83
|
nodeGroup,
|
|
80
84
|
edgeGroup,
|
|
81
85
|
comboGroup,
|
|
86
|
+
nodeLabelGroup,
|
|
87
|
+
edgeLabelGroup,
|
|
82
88
|
transientItemMap,
|
|
83
89
|
itemMap,
|
|
84
90
|
graphCore,
|
|
@@ -88,10 +94,13 @@ export const upsertTransientItem = (
|
|
|
88
94
|
}
|
|
89
95
|
transientItem = item.clone(
|
|
90
96
|
edgeGroup,
|
|
97
|
+
edgeLabelGroup,
|
|
91
98
|
source,
|
|
92
99
|
target,
|
|
93
100
|
shapeIds,
|
|
94
101
|
true,
|
|
102
|
+
visible,
|
|
103
|
+
transientItemMap,
|
|
95
104
|
) as Edge;
|
|
96
105
|
} else {
|
|
97
106
|
// find the succeeds to upsert transients
|
|
@@ -106,6 +115,8 @@ export const upsertTransientItem = (
|
|
|
106
115
|
nodeGroup,
|
|
107
116
|
edgeGroup,
|
|
108
117
|
comboGroup,
|
|
118
|
+
nodeLabelGroup,
|
|
119
|
+
edgeLabelGroup,
|
|
109
120
|
transientItemMap,
|
|
110
121
|
itemMap,
|
|
111
122
|
graphCore,
|
|
@@ -117,6 +128,7 @@ export const upsertTransientItem = (
|
|
|
117
128
|
});
|
|
118
129
|
transientItem = (item as Combo).clone(
|
|
119
130
|
comboGroup,
|
|
131
|
+
nodeLabelGroup,
|
|
120
132
|
shapeIds,
|
|
121
133
|
true,
|
|
122
134
|
() => getCombinedBoundsByItem(childItems), // getCombinedBounds
|
|
@@ -143,6 +155,8 @@ export const upsertTransientItem = (
|
|
|
143
155
|
nodeGroup,
|
|
144
156
|
edgeGroup,
|
|
145
157
|
comboGroup,
|
|
158
|
+
nodeLabelGroup,
|
|
159
|
+
edgeLabelGroup,
|
|
146
160
|
transientItemMap,
|
|
147
161
|
itemMap,
|
|
148
162
|
graphCore,
|
package/src/util/mapper.ts
CHANGED
|
@@ -32,7 +32,7 @@ export const DEFAULT_MAPPER = {
|
|
|
32
32
|
},
|
|
33
33
|
edge: (innerEdgeModel) => {
|
|
34
34
|
const { id, source, target, data } = innerEdgeModel;
|
|
35
|
-
const { color, label, icon, badge, keyShape } = data;
|
|
35
|
+
const { color, label, icon, badge, keyShape } = data || {};
|
|
36
36
|
const resultData: NodeDisplayModelData = {
|
|
37
37
|
...data,
|
|
38
38
|
keyShape: { ...keyShape },
|
package/src/util/path.ts
CHANGED
|
@@ -35,9 +35,79 @@ export const getControlPoint = (
|
|
|
35
35
|
return point;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
const PATH_COMMANDS = {
|
|
39
|
+
M: ['x', 'y'],
|
|
40
|
+
m: ['dx', 'dy'],
|
|
41
|
+
H: ['x'],
|
|
42
|
+
h: ['dx'],
|
|
43
|
+
V: ['y'],
|
|
44
|
+
v: ['dy'],
|
|
45
|
+
L: ['x', 'y'],
|
|
46
|
+
l: ['dx', 'dy'],
|
|
47
|
+
Z: [],
|
|
48
|
+
C: ['x1', 'y1', 'x2', 'y2', 'x', 'y'],
|
|
49
|
+
c: ['dx1', 'dy1', 'dx2', 'dy2', 'dx', 'dy'],
|
|
50
|
+
S: ['x2', 'y2', 'x', 'y'],
|
|
51
|
+
s: ['dx2', 'dy2', 'dx', 'dy'],
|
|
52
|
+
Q: ['x1', 'y1', 'x', 'y'],
|
|
53
|
+
q: ['dx1', 'dy1', 'dx', 'dy'],
|
|
54
|
+
T: ['x', 'y'],
|
|
55
|
+
t: ['dx', 'dy'],
|
|
56
|
+
A: ['rx', 'ry', 'rotation', 'large-arc', 'sweep', 'x', 'y'],
|
|
57
|
+
a: ['rx', 'ry', 'rotation', 'large-arc', 'sweep', 'dx', 'dy'],
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Converts a path string to an array of path segments.
|
|
62
|
+
* @param {string} path - The path string to convert.
|
|
63
|
+
* @returns {Array} - An array of path segments.
|
|
64
|
+
**/
|
|
65
|
+
const fromPathToArray = (path: string) => {
|
|
66
|
+
const items = path
|
|
67
|
+
.replace(/[\n\r]/g, '')
|
|
68
|
+
.replace(/-/g, ' -')
|
|
69
|
+
.replace(/(\d*\.)(\d+)(?=\.)/g, '$1$2 ')
|
|
70
|
+
.trim()
|
|
71
|
+
.split(/\s*,|\s+/);
|
|
72
|
+
const segments = [];
|
|
73
|
+
let currentCommand = '';
|
|
74
|
+
let currentElement = {};
|
|
75
|
+
while (items.length > 0) {
|
|
76
|
+
let it = items.shift();
|
|
77
|
+
if (PATH_COMMANDS.hasOwnProperty(it)) {
|
|
78
|
+
currentCommand = it;
|
|
79
|
+
} else {
|
|
80
|
+
items.unshift(it);
|
|
81
|
+
}
|
|
82
|
+
currentElement = { type: currentCommand };
|
|
83
|
+
PATH_COMMANDS[currentCommand].forEach((prop) => {
|
|
84
|
+
it = items.shift(); // TODO sanity check
|
|
85
|
+
currentElement[prop] = it;
|
|
86
|
+
});
|
|
87
|
+
if (currentCommand === 'M') {
|
|
88
|
+
currentCommand = 'L';
|
|
89
|
+
} else if (currentCommand === 'm') {
|
|
90
|
+
currentCommand = 'l';
|
|
91
|
+
}
|
|
92
|
+
segments.push(currentElement);
|
|
93
|
+
}
|
|
94
|
+
return segments;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Converts a path to an array of points.
|
|
99
|
+
* @param {Array|string} path - The path to convert to points.
|
|
100
|
+
* @returns {Array} - An array of points.
|
|
101
|
+
*/
|
|
102
|
+
export const pathToPoints = (path: any[] | string) => {
|
|
39
103
|
const points = [];
|
|
40
|
-
|
|
104
|
+
let segments = [];
|
|
105
|
+
if (typeof path === 'string') {
|
|
106
|
+
segments = fromPathToArray(path);
|
|
107
|
+
} else {
|
|
108
|
+
segments = path;
|
|
109
|
+
}
|
|
110
|
+
segments.forEach((seg) => {
|
|
41
111
|
const command = seg[0];
|
|
42
112
|
if (command !== 'A') {
|
|
43
113
|
for (let i = 1; i < seg.length; i = i + 2) {
|
package/src/util/polyline.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { AABB } from '@antv/g';
|
|
2
2
|
import { each } from '@antv/util';
|
|
3
3
|
import { ID } from '@antv/graphlib';
|
|
4
|
+
import { EdgeDisplayModel } from '../types/edge';
|
|
5
|
+
import { NodeDisplayModel } from '../types';
|
|
4
6
|
import Node from '../item/node';
|
|
7
|
+
import Item from '../item/item';
|
|
5
8
|
import { Point, PolyPoint } from '../types/common';
|
|
6
9
|
import {
|
|
7
10
|
getBBoxFromPoint,
|
|
@@ -18,24 +21,6 @@ import { manhattanDist } from './math';
|
|
|
18
21
|
import { RouterCfg } from './router';
|
|
19
22
|
import { isBending } from './point';
|
|
20
23
|
|
|
21
|
-
// class PolylineHistory {
|
|
22
|
-
// private pathMap: Map<ID, Point[]>;
|
|
23
|
-
|
|
24
|
-
// constructor() {
|
|
25
|
-
// this.pathMap = new Map<ID, Point[]>();
|
|
26
|
-
// }
|
|
27
|
-
|
|
28
|
-
// public addPath(edgeId: ID, points: Point[]): void {
|
|
29
|
-
// this.pathMap.set(edgeId, points);
|
|
30
|
-
// }
|
|
31
|
-
|
|
32
|
-
// public getPointsById(edgeId: ID): Point[] | undefined {
|
|
33
|
-
// return this.pathMap.get(edgeId);
|
|
34
|
-
// }
|
|
35
|
-
// }
|
|
36
|
-
|
|
37
|
-
// const polylineHistory = new PolylineHistory();
|
|
38
|
-
|
|
39
24
|
/**
|
|
40
25
|
* Simplify points of polyline by removing duplicated points
|
|
41
26
|
* @param points list of 2d points
|
|
@@ -341,9 +326,6 @@ export const getPolylinePath = (
|
|
|
341
326
|
|
|
342
327
|
const newPoints = removeRedundantPoint(points);
|
|
343
328
|
|
|
344
|
-
// Record polyline points
|
|
345
|
-
// polylineHistory.addPath(id, newPoints);
|
|
346
|
-
|
|
347
329
|
return pointsToPolyline(newPoints, radius, z);
|
|
348
330
|
};
|
|
349
331
|
|
|
@@ -436,8 +418,6 @@ export const getPolylinePoints = (
|
|
|
436
418
|
start,
|
|
437
419
|
end,
|
|
438
420
|
);
|
|
439
|
-
pathPoints.unshift(start);
|
|
440
|
-
pathPoints.push(end);
|
|
441
421
|
|
|
442
422
|
return simplifyPolylinePoints(pathPoints);
|
|
443
423
|
};
|
|
@@ -675,3 +655,30 @@ export class EdgeCollisionChecker {
|
|
|
675
655
|
return potentialCollisions;
|
|
676
656
|
}
|
|
677
657
|
}
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Check if the edge is a polyline and obstacle avoidance is enabled
|
|
661
|
+
*/
|
|
662
|
+
export const isPolylineWithObstacleAvoidance = (
|
|
663
|
+
displayModel: EdgeDisplayModel,
|
|
664
|
+
polylineEdgeType = ['polyline-edge'],
|
|
665
|
+
) => {
|
|
666
|
+
const { type, keyShape } = displayModel.data;
|
|
667
|
+
const isPolyline = polylineEdgeType.includes(type);
|
|
668
|
+
if (!isPolyline) return false;
|
|
669
|
+
// @ts-ignore
|
|
670
|
+
const isObstacleAvoidanceEnabled = (keyShape?.routeCfg as RouterCfg)
|
|
671
|
+
?.enableObstacleAvoidance;
|
|
672
|
+
return isObstacleAvoidanceEnabled;
|
|
673
|
+
};
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* Check if the node prevents polyline edges from overlapping
|
|
677
|
+
*/
|
|
678
|
+
export const isPointPreventPolylineOverlap = (
|
|
679
|
+
displayModel: NodeDisplayModel,
|
|
680
|
+
) => {
|
|
681
|
+
if (!displayModel) return false;
|
|
682
|
+
const { preventPolylineEdgeOverlap } = displayModel.data;
|
|
683
|
+
return preventPolylineEdgeOverlap || false;
|
|
684
|
+
};
|