@uipath/apollo-react 4.45.1 → 4.47.0
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/canvas/components/ButtonHandle/ButtonHandle.cjs +2 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.js +2 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.cjs +0 -33
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts +0 -2
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.js +1 -28
- package/dist/canvas/components/ButtonHandle/SmartHandle.cjs +2 -1
- package/dist/canvas/components/ButtonHandle/SmartHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/SmartHandle.js +2 -1
- package/dist/canvas/components/Edges/CanvasEdge.cjs +197 -0
- package/dist/canvas/components/Edges/CanvasEdge.d.ts +3 -0
- package/dist/canvas/components/Edges/CanvasEdge.d.ts.map +1 -0
- package/dist/canvas/components/Edges/CanvasEdge.js +163 -0
- package/dist/canvas/components/Edges/SequenceEdge.cjs +18 -200
- package/dist/canvas/components/Edges/SequenceEdge.d.ts +2 -2
- package/dist/canvas/components/Edges/SequenceEdge.d.ts.map +1 -1
- package/dist/canvas/components/Edges/SequenceEdge.js +19 -201
- package/dist/canvas/components/Edges/index.cjs +32 -3
- package/dist/canvas/components/Edges/index.d.ts +4 -0
- package/dist/canvas/components/Edges/index.d.ts.map +1 -1
- package/dist/canvas/components/Edges/index.js +3 -0
- package/dist/canvas/components/Edges/shared/areEdgePropsEqual.cjs +54 -0
- package/dist/canvas/components/Edges/shared/areEdgePropsEqual.d.ts +3 -0
- package/dist/canvas/components/Edges/shared/areEdgePropsEqual.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/areEdgePropsEqual.js +20 -0
- package/dist/canvas/components/Edges/shared/constants.cjs +107 -0
- package/dist/canvas/components/Edges/shared/constants.d.ts +33 -0
- package/dist/canvas/components/Edges/shared/constants.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/constants.js +55 -0
- package/dist/canvas/components/Edges/shared/geometry.cjs +489 -0
- package/dist/canvas/components/Edges/shared/geometry.d.ts +20 -0
- package/dist/canvas/components/Edges/shared/geometry.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/geometry.js +416 -0
- package/dist/canvas/components/Edges/shared/hooks/index.cjs +48 -0
- package/dist/canvas/components/Edges/shared/hooks/index.d.ts +5 -0
- package/dist/canvas/components/Edges/shared/hooks/index.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/hooks/index.js +5 -0
- package/dist/canvas/components/Edges/shared/hooks/useEdgeGeometry.cjs +103 -0
- package/dist/canvas/components/Edges/shared/hooks/useEdgeGeometry.d.ts +30 -0
- package/dist/canvas/components/Edges/shared/hooks/useEdgeGeometry.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/hooks/useEdgeGeometry.js +69 -0
- package/dist/canvas/components/Edges/shared/hooks/useEdgeWaypointWriter.cjs +69 -0
- package/dist/canvas/components/Edges/shared/hooks/useEdgeWaypointWriter.d.ts +3 -0
- package/dist/canvas/components/Edges/shared/hooks/useEdgeWaypointWriter.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/hooks/useEdgeWaypointWriter.js +35 -0
- package/dist/canvas/components/Edges/shared/hooks/useExecutionEdge.cjs +57 -0
- package/dist/canvas/components/Edges/shared/hooks/useExecutionEdge.d.ts +13 -0
- package/dist/canvas/components/Edges/shared/hooks/useExecutionEdge.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/hooks/useExecutionEdge.js +23 -0
- package/dist/canvas/components/Edges/shared/hooks/useNodeDragRebalance.cjs +98 -0
- package/dist/canvas/components/Edges/shared/hooks/useNodeDragRebalance.d.ts +18 -0
- package/dist/canvas/components/Edges/shared/hooks/useNodeDragRebalance.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/hooks/useNodeDragRebalance.js +64 -0
- package/dist/canvas/components/Edges/shared/hooks/useWaypointEditor.cjs +184 -0
- package/dist/canvas/components/Edges/shared/hooks/useWaypointEditor.d.ts +23 -0
- package/dist/canvas/components/Edges/shared/hooks/useWaypointEditor.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/hooks/useWaypointEditor.js +150 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgeArrow.cjs +57 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgeArrow.d.ts +10 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgeArrow.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgeArrow.js +23 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgeLabel.cjs +66 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgeLabel.d.ts +8 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgeLabel.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgeLabel.js +32 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgePath.cjs +84 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgePath.d.ts +16 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgePath.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgePath.js +50 -0
- package/dist/canvas/components/Edges/shared/primitives/SegmentDragHandle.cjs +117 -0
- package/dist/canvas/components/Edges/shared/primitives/SegmentDragHandle.d.ts +9 -0
- package/dist/canvas/components/Edges/shared/primitives/SegmentDragHandle.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/primitives/SegmentDragHandle.js +83 -0
- package/dist/canvas/components/Edges/shared/primitives/WaypointHandle.cjs +75 -0
- package/dist/canvas/components/Edges/shared/primitives/WaypointHandle.d.ts +10 -0
- package/dist/canvas/components/Edges/shared/primitives/WaypointHandle.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/primitives/WaypointHandle.js +41 -0
- package/dist/canvas/components/Edges/shared/primitives/index.cjs +52 -0
- package/dist/canvas/components/Edges/shared/primitives/index.d.ts +11 -0
- package/dist/canvas/components/Edges/shared/primitives/index.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/primitives/index.js +6 -0
- package/dist/canvas/components/Edges/shared/resolveEdgeColor.cjs +46 -0
- package/dist/canvas/components/Edges/shared/resolveEdgeColor.d.ts +11 -0
- package/dist/canvas/components/Edges/shared/resolveEdgeColor.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/resolveEdgeColor.js +12 -0
- package/dist/canvas/components/Edges/shared/routing/defaultEdgeRouter.cjs +51 -0
- package/dist/canvas/components/Edges/shared/routing/defaultEdgeRouter.d.ts +3 -0
- package/dist/canvas/components/Edges/shared/routing/defaultEdgeRouter.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/routing/defaultEdgeRouter.js +17 -0
- package/dist/canvas/components/Edges/shared/routing/index.cjs +43 -0
- package/dist/canvas/components/Edges/shared/routing/index.d.ts +4 -0
- package/dist/canvas/components/Edges/shared/routing/index.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/routing/index.js +3 -0
- package/dist/canvas/components/Edges/shared/routing/types.cjs +18 -0
- package/dist/canvas/components/Edges/shared/routing/types.d.ts +33 -0
- package/dist/canvas/components/Edges/shared/routing/types.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/routing/types.js +0 -0
- package/dist/canvas/components/Edges/shared/routing/useGraphRouter.cjs +175 -0
- package/dist/canvas/components/Edges/shared/routing/useGraphRouter.d.ts +5 -0
- package/dist/canvas/components/Edges/shared/routing/useGraphRouter.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/routing/useGraphRouter.js +138 -0
- package/dist/canvas/components/Edges/shared/types.cjs +18 -0
- package/dist/canvas/components/Edges/shared/types.d.ts +36 -0
- package/dist/canvas/components/Edges/shared/types.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/types.js +0 -0
- package/dist/canvas/components/Edges/shared/waypoints.cjs +216 -0
- package/dist/canvas/components/Edges/shared/waypoints.d.ts +17 -0
- package/dist/canvas/components/Edges/shared/waypoints.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/waypoints.js +158 -0
- package/dist/canvas/hooks/useEdgePath.cjs +6 -22
- package/dist/canvas/hooks/useEdgePath.d.ts +1 -1
- package/dist/canvas/hooks/useEdgePath.d.ts.map +1 -1
- package/dist/canvas/hooks/useEdgePath.js +5 -21
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/canvas/utils/handle-positioning.cjs +62 -0
- package/dist/canvas/utils/handle-positioning.d.ts +2 -0
- package/dist/canvas/utils/handle-positioning.d.ts.map +1 -0
- package/dist/canvas/utils/handle-positioning.js +28 -0
- package/dist/canvas/utils/index.cjs +21 -14
- package/dist/canvas/utils/index.d.ts +1 -0
- package/dist/canvas/utils/index.d.ts.map +1 -1
- package/dist/canvas/utils/index.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
ARROW_ANGLE_MAP: ()=>ARROW_ANGLE_MAP,
|
|
28
|
+
ARROW_OFFSETS: ()=>ARROW_OFFSETS,
|
|
29
|
+
EDGE_DASHARRAY: ()=>EDGE_DASHARRAY,
|
|
30
|
+
EDGE_CONSTANTS: ()=>EDGE_CONSTANTS,
|
|
31
|
+
EDGE_PATH_TRANSITION: ()=>EDGE_PATH_TRANSITION,
|
|
32
|
+
EMPTY_WAYPOINTS: ()=>EMPTY_WAYPOINTS,
|
|
33
|
+
EDGE_COLORS: ()=>EDGE_COLORS
|
|
34
|
+
});
|
|
35
|
+
const react_cjs_namespaceObject = require("../../../xyflow/react.cjs");
|
|
36
|
+
const external_constants_cjs_namespaceObject = require("../../../constants.cjs");
|
|
37
|
+
const EMPTY_WAYPOINTS = [];
|
|
38
|
+
const EDGE_CONSTANTS = {
|
|
39
|
+
BORDER_RADIUS: external_constants_cjs_namespaceObject.GRID_SPACING,
|
|
40
|
+
ARROW_SIZE: 10,
|
|
41
|
+
ARROW_HALF_ANGLE: Math.PI / 6,
|
|
42
|
+
STROKE_WIDTH: 2,
|
|
43
|
+
SELECTED_STROKE_WIDTH: 3,
|
|
44
|
+
INTERACTION_STROKE_WIDTH: 20,
|
|
45
|
+
SELECTED_OUTLINE_STROKE_WIDTH: 10,
|
|
46
|
+
SELECTED_OUTLINE_OPACITY: 0.3,
|
|
47
|
+
MIN_SEGMENT_LENGTH: 32,
|
|
48
|
+
COLLINEAR_TOLERANCE: 1,
|
|
49
|
+
ARROW_OFFSET: 8,
|
|
50
|
+
STUB_OFFSET: 2 * external_constants_cjs_namespaceObject.GRID_SPACING
|
|
51
|
+
};
|
|
52
|
+
const EDGE_PATH_TRANSITION = 'stroke 0.2s ease, opacity 0.2s ease';
|
|
53
|
+
const EDGE_DASHARRAY = {
|
|
54
|
+
solid: '0',
|
|
55
|
+
dashed: '5,5'
|
|
56
|
+
};
|
|
57
|
+
const EDGE_COLORS = {
|
|
58
|
+
default: 'var(--canvas-border)',
|
|
59
|
+
hover: 'var(--canvas-primary-hover)',
|
|
60
|
+
selected: 'var(--canvas-primary)',
|
|
61
|
+
invalid: 'var(--canvas-error-icon)',
|
|
62
|
+
diffAdded: 'var(--canvas-success-icon)',
|
|
63
|
+
diffRemoved: 'var(--canvas-error-icon)'
|
|
64
|
+
};
|
|
65
|
+
const ARROW_ANGLE_MAP = {
|
|
66
|
+
[react_cjs_namespaceObject.Position.Left]: 0,
|
|
67
|
+
[react_cjs_namespaceObject.Position.Right]: Math.PI,
|
|
68
|
+
[react_cjs_namespaceObject.Position.Top]: Math.PI / 2,
|
|
69
|
+
[react_cjs_namespaceObject.Position.Bottom]: -Math.PI / 2
|
|
70
|
+
};
|
|
71
|
+
const ARROW_OFFSETS = {
|
|
72
|
+
[react_cjs_namespaceObject.Position.Left]: {
|
|
73
|
+
x: EDGE_CONSTANTS.ARROW_OFFSET,
|
|
74
|
+
y: 0
|
|
75
|
+
},
|
|
76
|
+
[react_cjs_namespaceObject.Position.Right]: {
|
|
77
|
+
x: -EDGE_CONSTANTS.ARROW_OFFSET,
|
|
78
|
+
y: 0
|
|
79
|
+
},
|
|
80
|
+
[react_cjs_namespaceObject.Position.Top]: {
|
|
81
|
+
x: 0,
|
|
82
|
+
y: EDGE_CONSTANTS.ARROW_OFFSET
|
|
83
|
+
},
|
|
84
|
+
[react_cjs_namespaceObject.Position.Bottom]: {
|
|
85
|
+
x: 0,
|
|
86
|
+
y: -EDGE_CONSTANTS.ARROW_OFFSET
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
exports.ARROW_ANGLE_MAP = __webpack_exports__.ARROW_ANGLE_MAP;
|
|
90
|
+
exports.ARROW_OFFSETS = __webpack_exports__.ARROW_OFFSETS;
|
|
91
|
+
exports.EDGE_COLORS = __webpack_exports__.EDGE_COLORS;
|
|
92
|
+
exports.EDGE_CONSTANTS = __webpack_exports__.EDGE_CONSTANTS;
|
|
93
|
+
exports.EDGE_DASHARRAY = __webpack_exports__.EDGE_DASHARRAY;
|
|
94
|
+
exports.EDGE_PATH_TRANSITION = __webpack_exports__.EDGE_PATH_TRANSITION;
|
|
95
|
+
exports.EMPTY_WAYPOINTS = __webpack_exports__.EMPTY_WAYPOINTS;
|
|
96
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
97
|
+
"ARROW_ANGLE_MAP",
|
|
98
|
+
"ARROW_OFFSETS",
|
|
99
|
+
"EDGE_COLORS",
|
|
100
|
+
"EDGE_CONSTANTS",
|
|
101
|
+
"EDGE_DASHARRAY",
|
|
102
|
+
"EDGE_PATH_TRANSITION",
|
|
103
|
+
"EMPTY_WAYPOINTS"
|
|
104
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
105
|
+
Object.defineProperty(exports, '__esModule', {
|
|
106
|
+
value: true
|
|
107
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Position } from '../../../xyflow/react.ts';
|
|
2
|
+
import type { Point, Waypoint } from './types';
|
|
3
|
+
export declare const EMPTY_WAYPOINTS: Waypoint[];
|
|
4
|
+
export declare const EDGE_CONSTANTS: {
|
|
5
|
+
readonly BORDER_RADIUS: 16;
|
|
6
|
+
readonly ARROW_SIZE: 10;
|
|
7
|
+
readonly ARROW_HALF_ANGLE: number;
|
|
8
|
+
readonly STROKE_WIDTH: 2;
|
|
9
|
+
readonly SELECTED_STROKE_WIDTH: 3;
|
|
10
|
+
readonly INTERACTION_STROKE_WIDTH: 20;
|
|
11
|
+
readonly SELECTED_OUTLINE_STROKE_WIDTH: 10;
|
|
12
|
+
readonly SELECTED_OUTLINE_OPACITY: 0.3;
|
|
13
|
+
readonly MIN_SEGMENT_LENGTH: 32;
|
|
14
|
+
readonly COLLINEAR_TOLERANCE: 1;
|
|
15
|
+
readonly ARROW_OFFSET: 8;
|
|
16
|
+
readonly STUB_OFFSET: number;
|
|
17
|
+
};
|
|
18
|
+
export declare const EDGE_PATH_TRANSITION = "stroke 0.2s ease, opacity 0.2s ease";
|
|
19
|
+
export declare const EDGE_DASHARRAY: {
|
|
20
|
+
readonly solid: "0";
|
|
21
|
+
readonly dashed: "5,5";
|
|
22
|
+
};
|
|
23
|
+
export declare const EDGE_COLORS: {
|
|
24
|
+
readonly default: "var(--canvas-border)";
|
|
25
|
+
readonly hover: "var(--canvas-primary-hover)";
|
|
26
|
+
readonly selected: "var(--canvas-primary)";
|
|
27
|
+
readonly invalid: "var(--canvas-error-icon)";
|
|
28
|
+
readonly diffAdded: "var(--canvas-success-icon)";
|
|
29
|
+
readonly diffRemoved: "var(--canvas-error-icon)";
|
|
30
|
+
};
|
|
31
|
+
export declare const ARROW_ANGLE_MAP: Record<Position, number>;
|
|
32
|
+
export declare const ARROW_OFFSETS: Record<Position, Point>;
|
|
33
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Edges/shared/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAEpE,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAI/C,eAAO,MAAM,eAAe,EAAE,QAAQ,EAAO,CAAC;AAE9C,eAAO,MAAM,cAAc;;;;;;;;;;;;;CAiCjB,CAAC;AAGX,eAAO,MAAM,oBAAoB,wCAAwC,CAAC;AAG1E,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AAMX,eAAO,MAAM,WAAW;;;;;;;CAOd,CAAC;AAOX,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAKpD,CAAC;AASF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,QAAQ,EAAE,KAAK,CAKjD,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Position } from "../../../xyflow/react.js";
|
|
2
|
+
import { GRID_SPACING } from "../../../constants.js";
|
|
3
|
+
const EMPTY_WAYPOINTS = [];
|
|
4
|
+
const EDGE_CONSTANTS = {
|
|
5
|
+
BORDER_RADIUS: GRID_SPACING,
|
|
6
|
+
ARROW_SIZE: 10,
|
|
7
|
+
ARROW_HALF_ANGLE: Math.PI / 6,
|
|
8
|
+
STROKE_WIDTH: 2,
|
|
9
|
+
SELECTED_STROKE_WIDTH: 3,
|
|
10
|
+
INTERACTION_STROKE_WIDTH: 20,
|
|
11
|
+
SELECTED_OUTLINE_STROKE_WIDTH: 10,
|
|
12
|
+
SELECTED_OUTLINE_OPACITY: 0.3,
|
|
13
|
+
MIN_SEGMENT_LENGTH: 32,
|
|
14
|
+
COLLINEAR_TOLERANCE: 1,
|
|
15
|
+
ARROW_OFFSET: 8,
|
|
16
|
+
STUB_OFFSET: 2 * GRID_SPACING
|
|
17
|
+
};
|
|
18
|
+
const EDGE_PATH_TRANSITION = 'stroke 0.2s ease, opacity 0.2s ease';
|
|
19
|
+
const EDGE_DASHARRAY = {
|
|
20
|
+
solid: '0',
|
|
21
|
+
dashed: '5,5'
|
|
22
|
+
};
|
|
23
|
+
const EDGE_COLORS = {
|
|
24
|
+
default: 'var(--canvas-border)',
|
|
25
|
+
hover: 'var(--canvas-primary-hover)',
|
|
26
|
+
selected: 'var(--canvas-primary)',
|
|
27
|
+
invalid: 'var(--canvas-error-icon)',
|
|
28
|
+
diffAdded: 'var(--canvas-success-icon)',
|
|
29
|
+
diffRemoved: 'var(--canvas-error-icon)'
|
|
30
|
+
};
|
|
31
|
+
const ARROW_ANGLE_MAP = {
|
|
32
|
+
[Position.Left]: 0,
|
|
33
|
+
[Position.Right]: Math.PI,
|
|
34
|
+
[Position.Top]: Math.PI / 2,
|
|
35
|
+
[Position.Bottom]: -Math.PI / 2
|
|
36
|
+
};
|
|
37
|
+
const ARROW_OFFSETS = {
|
|
38
|
+
[Position.Left]: {
|
|
39
|
+
x: EDGE_CONSTANTS.ARROW_OFFSET,
|
|
40
|
+
y: 0
|
|
41
|
+
},
|
|
42
|
+
[Position.Right]: {
|
|
43
|
+
x: -EDGE_CONSTANTS.ARROW_OFFSET,
|
|
44
|
+
y: 0
|
|
45
|
+
},
|
|
46
|
+
[Position.Top]: {
|
|
47
|
+
x: 0,
|
|
48
|
+
y: EDGE_CONSTANTS.ARROW_OFFSET
|
|
49
|
+
},
|
|
50
|
+
[Position.Bottom]: {
|
|
51
|
+
x: 0,
|
|
52
|
+
y: -EDGE_CONSTANTS.ARROW_OFFSET
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
export { ARROW_ANGLE_MAP, ARROW_OFFSETS, EDGE_COLORS, EDGE_CONSTANTS, EDGE_DASHARRAY, EDGE_PATH_TRANSITION, EMPTY_WAYPOINTS };
|
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
snapPointToGrid: ()=>snapPointToGrid,
|
|
28
|
+
isSegmentPerpendicular: ()=>isSegmentPerpendicular,
|
|
29
|
+
calculateAutoWaypoints: ()=>calculateAutoWaypoints,
|
|
30
|
+
consolidateWaypoints: ()=>consolidateWaypoints,
|
|
31
|
+
getSegmentLength: ()=>getSegmentLength,
|
|
32
|
+
isSegmentInteractable: ()=>isSegmentInteractable,
|
|
33
|
+
getSegmentOrientation: ()=>getSegmentOrientation,
|
|
34
|
+
buildPathVertices: ()=>buildPathVertices,
|
|
35
|
+
createRoundedPath: ()=>createRoundedPath,
|
|
36
|
+
extractSegments: ()=>extractSegments,
|
|
37
|
+
getPathArcMidpoint: ()=>getPathArcMidpoint,
|
|
38
|
+
getSegmentMidpoint: ()=>getSegmentMidpoint,
|
|
39
|
+
isHorizontalPosition: ()=>isHorizontalPosition,
|
|
40
|
+
routeAnchorToPoint: ()=>routeAnchorToPoint
|
|
41
|
+
});
|
|
42
|
+
const NodeUtils_cjs_namespaceObject = require("../../../utils/NodeUtils.cjs");
|
|
43
|
+
const external_constants_cjs_namespaceObject = require("./constants.cjs");
|
|
44
|
+
const { BORDER_RADIUS, MIN_SEGMENT_LENGTH, COLLINEAR_TOLERANCE: TOL } = external_constants_cjs_namespaceObject.EDGE_CONSTANTS;
|
|
45
|
+
function snapPointToGrid(point) {
|
|
46
|
+
return {
|
|
47
|
+
x: (0, NodeUtils_cjs_namespaceObject.snapToGrid)(point.x),
|
|
48
|
+
y: (0, NodeUtils_cjs_namespaceObject.snapToGrid)(point.y)
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function getDirection(position) {
|
|
52
|
+
switch(position){
|
|
53
|
+
case 'left':
|
|
54
|
+
return {
|
|
55
|
+
dx: -1,
|
|
56
|
+
dy: 0
|
|
57
|
+
};
|
|
58
|
+
case 'right':
|
|
59
|
+
return {
|
|
60
|
+
dx: 1,
|
|
61
|
+
dy: 0
|
|
62
|
+
};
|
|
63
|
+
case 'top':
|
|
64
|
+
return {
|
|
65
|
+
dx: 0,
|
|
66
|
+
dy: -1
|
|
67
|
+
};
|
|
68
|
+
case 'bottom':
|
|
69
|
+
return {
|
|
70
|
+
dx: 0,
|
|
71
|
+
dy: 1
|
|
72
|
+
};
|
|
73
|
+
default:
|
|
74
|
+
return {
|
|
75
|
+
dx: 1,
|
|
76
|
+
dy: 0
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function isHorizontalPosition(position) {
|
|
81
|
+
return 0 !== getDirection(position).dx;
|
|
82
|
+
}
|
|
83
|
+
function calculateAutoWaypoints(sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition) {
|
|
84
|
+
const sourceOffset = external_constants_cjs_namespaceObject.ARROW_OFFSETS[sourcePosition];
|
|
85
|
+
const targetOffset = external_constants_cjs_namespaceObject.ARROW_OFFSETS[targetPosition];
|
|
86
|
+
const startX = sourceX + sourceOffset.x;
|
|
87
|
+
const startY = sourceY + sourceOffset.y;
|
|
88
|
+
const endX = targetX + targetOffset.x;
|
|
89
|
+
const endY = targetY + targetOffset.y;
|
|
90
|
+
const isSourceHorizontal = isHorizontalPosition(sourcePosition);
|
|
91
|
+
const isTargetHorizontal = isHorizontalPosition(targetPosition);
|
|
92
|
+
const waypoints = [];
|
|
93
|
+
if (isSourceHorizontal && isTargetHorizontal) {
|
|
94
|
+
const midX = (0, NodeUtils_cjs_namespaceObject.snapToGrid)((startX + endX) / 2);
|
|
95
|
+
if (Math.abs(startY - endY) > MIN_SEGMENT_LENGTH / 2) {
|
|
96
|
+
waypoints.push({
|
|
97
|
+
x: midX,
|
|
98
|
+
y: startY
|
|
99
|
+
});
|
|
100
|
+
waypoints.push({
|
|
101
|
+
x: midX,
|
|
102
|
+
y: endY
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
} else if (isSourceHorizontal || isTargetHorizontal) if (isSourceHorizontal && !isTargetHorizontal) waypoints.push({
|
|
106
|
+
x: endX,
|
|
107
|
+
y: startY
|
|
108
|
+
});
|
|
109
|
+
else waypoints.push({
|
|
110
|
+
x: startX,
|
|
111
|
+
y: endY
|
|
112
|
+
});
|
|
113
|
+
else {
|
|
114
|
+
const midY = (0, NodeUtils_cjs_namespaceObject.snapToGrid)((startY + endY) / 2);
|
|
115
|
+
if (Math.abs(startX - endX) > MIN_SEGMENT_LENGTH / 2) {
|
|
116
|
+
waypoints.push({
|
|
117
|
+
x: startX,
|
|
118
|
+
y: midY
|
|
119
|
+
});
|
|
120
|
+
waypoints.push({
|
|
121
|
+
x: endX,
|
|
122
|
+
y: midY
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return waypoints;
|
|
127
|
+
}
|
|
128
|
+
function routeAnchorToPoint(anchor, anchorPosition, point) {
|
|
129
|
+
const dir = getDirection(anchorPosition);
|
|
130
|
+
const isHorizontal = 0 !== dir.dx;
|
|
131
|
+
const forward = isHorizontal ? (point.x - anchor.x) * dir.dx : (point.y - anchor.y) * dir.dy;
|
|
132
|
+
let elbows;
|
|
133
|
+
if (forward >= 0) elbows = isHorizontal ? [
|
|
134
|
+
{
|
|
135
|
+
x: point.x,
|
|
136
|
+
y: anchor.y
|
|
137
|
+
}
|
|
138
|
+
] : [
|
|
139
|
+
{
|
|
140
|
+
x: anchor.x,
|
|
141
|
+
y: point.y
|
|
142
|
+
}
|
|
143
|
+
];
|
|
144
|
+
else {
|
|
145
|
+
const { STUB_OFFSET } = external_constants_cjs_namespaceObject.EDGE_CONSTANTS;
|
|
146
|
+
elbows = isHorizontal ? [
|
|
147
|
+
{
|
|
148
|
+
x: anchor.x + dir.dx * STUB_OFFSET,
|
|
149
|
+
y: anchor.y
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
x: anchor.x + dir.dx * STUB_OFFSET,
|
|
153
|
+
y: point.y
|
|
154
|
+
}
|
|
155
|
+
] : [
|
|
156
|
+
{
|
|
157
|
+
x: anchor.x,
|
|
158
|
+
y: anchor.y + dir.dy * STUB_OFFSET
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
x: point.x,
|
|
162
|
+
y: anchor.y + dir.dy * STUB_OFFSET
|
|
163
|
+
}
|
|
164
|
+
];
|
|
165
|
+
}
|
|
166
|
+
const result = [];
|
|
167
|
+
let prev = anchor;
|
|
168
|
+
for (const elbow of elbows){
|
|
169
|
+
const samePrev = Math.abs(elbow.x - prev.x) < TOL && Math.abs(elbow.y - prev.y) < TOL;
|
|
170
|
+
const samePoint = Math.abs(elbow.x - point.x) < TOL && Math.abs(elbow.y - point.y) < TOL;
|
|
171
|
+
if (!samePrev && !samePoint) {
|
|
172
|
+
result.push(elbow);
|
|
173
|
+
prev = elbow;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return result;
|
|
177
|
+
}
|
|
178
|
+
function connectorElbow(from, to, incoming) {
|
|
179
|
+
const alignedX = Math.abs(from.x - to.x) < TOL;
|
|
180
|
+
const alignedY = Math.abs(from.y - to.y) < TOL;
|
|
181
|
+
if (alignedX || alignedY) return null;
|
|
182
|
+
return 'horizontal' === incoming ? {
|
|
183
|
+
x: from.x,
|
|
184
|
+
y: to.y
|
|
185
|
+
} : {
|
|
186
|
+
x: to.x,
|
|
187
|
+
y: from.y
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function buildPathVertices(sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition, waypoints = []) {
|
|
191
|
+
const sourceOffset = external_constants_cjs_namespaceObject.ARROW_OFFSETS[sourcePosition];
|
|
192
|
+
const targetOffset = external_constants_cjs_namespaceObject.ARROW_OFFSETS[targetPosition];
|
|
193
|
+
const start = {
|
|
194
|
+
x: sourceX + sourceOffset.x,
|
|
195
|
+
y: sourceY + sourceOffset.y
|
|
196
|
+
};
|
|
197
|
+
const end = {
|
|
198
|
+
x: targetX + targetOffset.x,
|
|
199
|
+
y: targetY + targetOffset.y
|
|
200
|
+
};
|
|
201
|
+
const derived = (p)=>({
|
|
202
|
+
x: p.x,
|
|
203
|
+
y: p.y,
|
|
204
|
+
waypointIndex: -1
|
|
205
|
+
});
|
|
206
|
+
if (0 === waypoints.length) {
|
|
207
|
+
const autoWaypoints = calculateAutoWaypoints(sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition);
|
|
208
|
+
return [
|
|
209
|
+
start,
|
|
210
|
+
...autoWaypoints,
|
|
211
|
+
end
|
|
212
|
+
].map(derived);
|
|
213
|
+
}
|
|
214
|
+
const startVertex = derived(start);
|
|
215
|
+
const endVertex = derived(end);
|
|
216
|
+
const path = [
|
|
217
|
+
startVertex
|
|
218
|
+
];
|
|
219
|
+
for (const elbow of routeAnchorToPoint(start, sourcePosition, waypoints[0]))path.push(derived(elbow));
|
|
220
|
+
path.push({
|
|
221
|
+
x: waypoints[0].x,
|
|
222
|
+
y: waypoints[0].y,
|
|
223
|
+
waypointIndex: 0
|
|
224
|
+
});
|
|
225
|
+
for(let i = 1; i < waypoints.length; i++){
|
|
226
|
+
const from = path[path.length - 1];
|
|
227
|
+
const incoming = path.length >= 2 ? getSegmentOrientation(path[path.length - 2], from) : null;
|
|
228
|
+
const elbow = connectorElbow(from, waypoints[i], incoming);
|
|
229
|
+
if (elbow) path.push(derived(elbow));
|
|
230
|
+
path.push({
|
|
231
|
+
x: waypoints[i].x,
|
|
232
|
+
y: waypoints[i].y,
|
|
233
|
+
waypointIndex: i
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
const targetStub = routeAnchorToPoint(end, targetPosition, waypoints[waypoints.length - 1]);
|
|
237
|
+
for(let j = targetStub.length - 1; j >= 0; j--)path.push(derived(targetStub[j]));
|
|
238
|
+
const interior = consolidateWaypoints(path.slice(1), start, end, (v)=>v.waypointIndex >= 0);
|
|
239
|
+
return [
|
|
240
|
+
startVertex,
|
|
241
|
+
...interior,
|
|
242
|
+
endVertex
|
|
243
|
+
];
|
|
244
|
+
}
|
|
245
|
+
function consolidateWaypoints(points, pathStart, pathEnd, isProtected = ()=>false) {
|
|
246
|
+
let current = points;
|
|
247
|
+
let changed = true;
|
|
248
|
+
while(changed && current.length > 0){
|
|
249
|
+
changed = false;
|
|
250
|
+
const before = current.length;
|
|
251
|
+
if (current.length > 1) {
|
|
252
|
+
const deduped = [
|
|
253
|
+
current[0]
|
|
254
|
+
];
|
|
255
|
+
for(let i = 1; i < current.length; i++){
|
|
256
|
+
const prev = deduped[deduped.length - 1];
|
|
257
|
+
const curr = current[i];
|
|
258
|
+
if (Math.abs(curr.x - prev.x) > TOL || Math.abs(curr.y - prev.y) > TOL) deduped.push(curr);
|
|
259
|
+
else if (isProtected(curr) && !isProtected(prev)) deduped[deduped.length - 1] = curr;
|
|
260
|
+
}
|
|
261
|
+
current = deduped;
|
|
262
|
+
}
|
|
263
|
+
if (current.length > 2) {
|
|
264
|
+
const result = [
|
|
265
|
+
current[0]
|
|
266
|
+
];
|
|
267
|
+
for(let i = 1; i < current.length - 1; i++){
|
|
268
|
+
const prev = result[result.length - 1];
|
|
269
|
+
const curr = current[i];
|
|
270
|
+
const next = current[i + 1];
|
|
271
|
+
const horizontalLine = Math.abs(prev.y - curr.y) <= TOL && Math.abs(curr.y - next.y) <= TOL;
|
|
272
|
+
const verticalLine = Math.abs(prev.x - curr.x) <= TOL && Math.abs(curr.x - next.x) <= TOL;
|
|
273
|
+
if (!horizontalLine && !verticalLine || isProtected(curr)) result.push(curr);
|
|
274
|
+
}
|
|
275
|
+
result.push(current[current.length - 1]);
|
|
276
|
+
current = result;
|
|
277
|
+
}
|
|
278
|
+
if (current.length >= 2) {
|
|
279
|
+
const first = current[0];
|
|
280
|
+
const second = current[1];
|
|
281
|
+
const collinearH = Math.abs(pathStart.y - first.y) <= TOL && Math.abs(first.y - second.y) <= TOL;
|
|
282
|
+
const collinearV = Math.abs(pathStart.x - first.x) <= TOL && Math.abs(first.x - second.x) <= TOL;
|
|
283
|
+
if ((collinearH || collinearV) && !isProtected(first)) current = current.slice(1);
|
|
284
|
+
}
|
|
285
|
+
if (current.length >= 2) {
|
|
286
|
+
const last = current[current.length - 1];
|
|
287
|
+
const secondLast = current[current.length - 2];
|
|
288
|
+
const collinearH = Math.abs(secondLast.y - last.y) <= TOL && Math.abs(last.y - pathEnd.y) <= TOL;
|
|
289
|
+
const collinearV = Math.abs(secondLast.x - last.x) <= TOL && Math.abs(last.x - pathEnd.x) <= TOL;
|
|
290
|
+
if ((collinearH || collinearV) && !isProtected(last)) current = current.slice(0, -1);
|
|
291
|
+
}
|
|
292
|
+
if (1 === current.length) {
|
|
293
|
+
const wp = current[0];
|
|
294
|
+
const collinearH = Math.abs(pathStart.y - wp.y) <= TOL && Math.abs(wp.y - pathEnd.y) <= TOL;
|
|
295
|
+
const collinearV = Math.abs(pathStart.x - wp.x) <= TOL && Math.abs(wp.x - pathEnd.x) <= TOL;
|
|
296
|
+
if ((collinearH || collinearV) && !isProtected(wp)) current = [];
|
|
297
|
+
}
|
|
298
|
+
if (current.length >= 2) {
|
|
299
|
+
const cleaned = [];
|
|
300
|
+
for(let i = 0; i < current.length; i++){
|
|
301
|
+
const curr = current[i];
|
|
302
|
+
const prev = cleaned[cleaned.length - 1];
|
|
303
|
+
const next = current[i + 1];
|
|
304
|
+
if (!isProtected(curr)) {
|
|
305
|
+
if (prev && Math.abs(curr.x - prev.x) <= TOL && Math.abs(curr.y - prev.y) <= TOL) continue;
|
|
306
|
+
if (next && Math.abs(curr.x - next.x) <= TOL && Math.abs(curr.y - next.y) <= TOL) continue;
|
|
307
|
+
}
|
|
308
|
+
cleaned.push(curr);
|
|
309
|
+
}
|
|
310
|
+
current = cleaned;
|
|
311
|
+
}
|
|
312
|
+
changed = current.length !== before;
|
|
313
|
+
}
|
|
314
|
+
return current;
|
|
315
|
+
}
|
|
316
|
+
function getSegmentOrientation(start, end) {
|
|
317
|
+
return Math.abs(end.x - start.x) > Math.abs(end.y - start.y) ? 'horizontal' : 'vertical';
|
|
318
|
+
}
|
|
319
|
+
function isSegmentPerpendicular(segment) {
|
|
320
|
+
const dx = Math.abs(segment.end.x - segment.start.x);
|
|
321
|
+
const dy = Math.abs(segment.end.y - segment.start.y);
|
|
322
|
+
return dx < TOL || dy < TOL;
|
|
323
|
+
}
|
|
324
|
+
function extractSegments(pathPoints) {
|
|
325
|
+
const segments = [];
|
|
326
|
+
const interiorCount = Math.max(0, pathPoints.length - 2);
|
|
327
|
+
for(let i = 0; i < pathPoints.length - 1; i++){
|
|
328
|
+
const start = pathPoints[i];
|
|
329
|
+
const end = pathPoints[i + 1];
|
|
330
|
+
segments.push({
|
|
331
|
+
id: `seg-${i}`,
|
|
332
|
+
start: {
|
|
333
|
+
x: start.x,
|
|
334
|
+
y: start.y
|
|
335
|
+
},
|
|
336
|
+
end: {
|
|
337
|
+
x: end.x,
|
|
338
|
+
y: end.y
|
|
339
|
+
},
|
|
340
|
+
orientation: getSegmentOrientation(start, end),
|
|
341
|
+
waypointIndexBefore: i - 1,
|
|
342
|
+
waypointIndexAfter: i < interiorCount ? i : interiorCount
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
return segments;
|
|
346
|
+
}
|
|
347
|
+
function createRoundedPath(points, borderRadius = BORDER_RADIUS) {
|
|
348
|
+
if (points.length < 2) return '';
|
|
349
|
+
const firstPoint = points[0];
|
|
350
|
+
const path = [
|
|
351
|
+
`M ${firstPoint.x} ${firstPoint.y}`
|
|
352
|
+
];
|
|
353
|
+
if (2 === points.length) {
|
|
354
|
+
const secondPoint = points[1];
|
|
355
|
+
path.push(`L ${secondPoint.x} ${secondPoint.y}`);
|
|
356
|
+
return path.join(' ');
|
|
357
|
+
}
|
|
358
|
+
for(let i = 1; i < points.length - 1; i++){
|
|
359
|
+
const prev = points[i - 1];
|
|
360
|
+
const curr = points[i];
|
|
361
|
+
const next = points[i + 1];
|
|
362
|
+
const v1 = {
|
|
363
|
+
x: curr.x - prev.x,
|
|
364
|
+
y: curr.y - prev.y
|
|
365
|
+
};
|
|
366
|
+
const v2 = {
|
|
367
|
+
x: next.x - curr.x,
|
|
368
|
+
y: next.y - curr.y
|
|
369
|
+
};
|
|
370
|
+
const len1 = Math.sqrt(v1.x * v1.x + v1.y * v1.y);
|
|
371
|
+
const len2 = Math.sqrt(v2.x * v2.x + v2.y * v2.y);
|
|
372
|
+
const radius = Math.min(borderRadius, Math.min(len1, len2) / 2);
|
|
373
|
+
if (radius < 1) {
|
|
374
|
+
path.push(`L ${curr.x} ${curr.y}`);
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
const n1 = {
|
|
378
|
+
x: v1.x / len1,
|
|
379
|
+
y: v1.y / len1
|
|
380
|
+
};
|
|
381
|
+
const n2 = {
|
|
382
|
+
x: v2.x / len2,
|
|
383
|
+
y: v2.y / len2
|
|
384
|
+
};
|
|
385
|
+
const cornerStart = {
|
|
386
|
+
x: curr.x - n1.x * radius,
|
|
387
|
+
y: curr.y - n1.y * radius
|
|
388
|
+
};
|
|
389
|
+
const cornerEnd = {
|
|
390
|
+
x: curr.x + n2.x * radius,
|
|
391
|
+
y: curr.y + n2.y * radius
|
|
392
|
+
};
|
|
393
|
+
path.push(`L ${cornerStart.x} ${cornerStart.y}`);
|
|
394
|
+
path.push(`Q ${curr.x} ${curr.y} ${cornerEnd.x} ${cornerEnd.y}`);
|
|
395
|
+
}
|
|
396
|
+
const lastPoint = points[points.length - 1];
|
|
397
|
+
path.push(`L ${lastPoint.x} ${lastPoint.y}`);
|
|
398
|
+
return path.join(' ');
|
|
399
|
+
}
|
|
400
|
+
function getSegmentMidpoint(segment) {
|
|
401
|
+
return {
|
|
402
|
+
x: (segment.start.x + segment.end.x) / 2,
|
|
403
|
+
y: (segment.start.y + segment.end.y) / 2
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
function getSegmentLength(segment) {
|
|
407
|
+
const dx = segment.end.x - segment.start.x;
|
|
408
|
+
const dy = segment.end.y - segment.start.y;
|
|
409
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
410
|
+
}
|
|
411
|
+
function isSegmentInteractable(segment) {
|
|
412
|
+
return getSegmentLength(segment) >= MIN_SEGMENT_LENGTH;
|
|
413
|
+
}
|
|
414
|
+
function getPathArcMidpoint(points) {
|
|
415
|
+
if (0 === points.length) return {
|
|
416
|
+
x: 0,
|
|
417
|
+
y: 0
|
|
418
|
+
};
|
|
419
|
+
if (1 === points.length) return {
|
|
420
|
+
x: points[0].x,
|
|
421
|
+
y: points[0].y
|
|
422
|
+
};
|
|
423
|
+
const lengths = [];
|
|
424
|
+
let total = 0;
|
|
425
|
+
for(let i = 0; i < points.length - 1; i++){
|
|
426
|
+
const dx = points[i + 1].x - points[i].x;
|
|
427
|
+
const dy = points[i + 1].y - points[i].y;
|
|
428
|
+
const len = Math.sqrt(dx * dx + dy * dy);
|
|
429
|
+
lengths.push(len);
|
|
430
|
+
total += len;
|
|
431
|
+
}
|
|
432
|
+
if (0 === total) return {
|
|
433
|
+
x: points[0].x,
|
|
434
|
+
y: points[0].y
|
|
435
|
+
};
|
|
436
|
+
const target = total / 2;
|
|
437
|
+
let acc = 0;
|
|
438
|
+
for(let i = 0; i < lengths.length; i++){
|
|
439
|
+
const segLen = lengths[i];
|
|
440
|
+
if (acc + segLen >= target) {
|
|
441
|
+
const t = (target - acc) / segLen;
|
|
442
|
+
const start = points[i];
|
|
443
|
+
const end = points[i + 1];
|
|
444
|
+
return {
|
|
445
|
+
x: start.x + t * (end.x - start.x),
|
|
446
|
+
y: start.y + t * (end.y - start.y)
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
acc += segLen;
|
|
450
|
+
}
|
|
451
|
+
const last = points[points.length - 1];
|
|
452
|
+
return {
|
|
453
|
+
x: last.x,
|
|
454
|
+
y: last.y
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
exports.buildPathVertices = __webpack_exports__.buildPathVertices;
|
|
458
|
+
exports.calculateAutoWaypoints = __webpack_exports__.calculateAutoWaypoints;
|
|
459
|
+
exports.consolidateWaypoints = __webpack_exports__.consolidateWaypoints;
|
|
460
|
+
exports.createRoundedPath = __webpack_exports__.createRoundedPath;
|
|
461
|
+
exports.extractSegments = __webpack_exports__.extractSegments;
|
|
462
|
+
exports.getPathArcMidpoint = __webpack_exports__.getPathArcMidpoint;
|
|
463
|
+
exports.getSegmentLength = __webpack_exports__.getSegmentLength;
|
|
464
|
+
exports.getSegmentMidpoint = __webpack_exports__.getSegmentMidpoint;
|
|
465
|
+
exports.getSegmentOrientation = __webpack_exports__.getSegmentOrientation;
|
|
466
|
+
exports.isHorizontalPosition = __webpack_exports__.isHorizontalPosition;
|
|
467
|
+
exports.isSegmentInteractable = __webpack_exports__.isSegmentInteractable;
|
|
468
|
+
exports.isSegmentPerpendicular = __webpack_exports__.isSegmentPerpendicular;
|
|
469
|
+
exports.routeAnchorToPoint = __webpack_exports__.routeAnchorToPoint;
|
|
470
|
+
exports.snapPointToGrid = __webpack_exports__.snapPointToGrid;
|
|
471
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
472
|
+
"buildPathVertices",
|
|
473
|
+
"calculateAutoWaypoints",
|
|
474
|
+
"consolidateWaypoints",
|
|
475
|
+
"createRoundedPath",
|
|
476
|
+
"extractSegments",
|
|
477
|
+
"getPathArcMidpoint",
|
|
478
|
+
"getSegmentLength",
|
|
479
|
+
"getSegmentMidpoint",
|
|
480
|
+
"getSegmentOrientation",
|
|
481
|
+
"isHorizontalPosition",
|
|
482
|
+
"isSegmentInteractable",
|
|
483
|
+
"isSegmentPerpendicular",
|
|
484
|
+
"routeAnchorToPoint",
|
|
485
|
+
"snapPointToGrid"
|
|
486
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
487
|
+
Object.defineProperty(exports, '__esModule', {
|
|
488
|
+
value: true
|
|
489
|
+
});
|