@uipath/apollo-react 6.17.3 → 6.18.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/BaseCanvas/CanvasProviders.cjs +10 -7
- package/dist/canvas/components/BaseCanvas/CanvasProviders.d.ts.map +1 -1
- package/dist/canvas/components/BaseCanvas/CanvasProviders.js +10 -7
- package/dist/canvas/components/Edges/CanvasEdge.cjs +11 -5
- package/dist/canvas/components/Edges/CanvasEdge.d.ts.map +1 -1
- package/dist/canvas/components/Edges/CanvasEdge.js +12 -6
- package/dist/canvas/components/Edges/index.cjs +12 -4
- package/dist/canvas/components/Edges/index.d.ts +2 -1
- package/dist/canvas/components/Edges/index.d.ts.map +1 -1
- package/dist/canvas/components/Edges/index.js +2 -1
- package/dist/canvas/components/Edges/shared/constants.cjs +1 -0
- package/dist/canvas/components/Edges/shared/constants.d.ts +1 -0
- package/dist/canvas/components/Edges/shared/constants.d.ts.map +1 -1
- package/dist/canvas/components/Edges/shared/constants.js +1 -0
- package/dist/canvas/components/Edges/shared/crossings/EdgeCrossingsContext.cjs +122 -0
- package/dist/canvas/components/Edges/shared/crossings/EdgeCrossingsContext.d.ts +22 -0
- package/dist/canvas/components/Edges/shared/crossings/EdgeCrossingsContext.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/crossings/EdgeCrossingsContext.js +79 -0
- package/dist/canvas/components/Edges/shared/crossings/crossings.cjs +139 -0
- package/dist/canvas/components/Edges/shared/crossings/crossings.d.ts +9 -0
- package/dist/canvas/components/Edges/shared/crossings/crossings.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/crossings/crossings.js +99 -0
- package/dist/canvas/components/Edges/shared/crossings/index.cjs +50 -0
- package/dist/canvas/components/Edges/shared/crossings/index.d.ts +4 -0
- package/dist/canvas/components/Edges/shared/crossings/index.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/crossings/index.js +4 -0
- package/dist/canvas/components/Edges/shared/crossings/useEdgeLineJumps.cjs +67 -0
- package/dist/canvas/components/Edges/shared/crossings/useEdgeLineJumps.d.ts +3 -0
- package/dist/canvas/components/Edges/shared/crossings/useEdgeLineJumps.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/crossings/useEdgeLineJumps.js +33 -0
- package/dist/canvas/components/Edges/shared/geometry.cjs +83 -44
- package/dist/canvas/components/Edges/shared/geometry.d.ts +2 -2
- package/dist/canvas/components/Edges/shared/geometry.d.ts.map +1 -1
- package/dist/canvas/components/Edges/shared/geometry.js +83 -44
- package/dist/canvas/components/Edges/shared/hooks/useEdgeGeometry.cjs +6 -3
- package/dist/canvas/components/Edges/shared/hooks/useEdgeGeometry.d.ts +2 -0
- package/dist/canvas/components/Edges/shared/hooks/useEdgeGeometry.d.ts.map +1 -1
- package/dist/canvas/components/Edges/shared/hooks/useEdgeGeometry.js +6 -3
- package/dist/canvas/components/Edges/shared/primitives/EdgeArrow.cjs +4 -3
- package/dist/canvas/components/Edges/shared/primitives/EdgeArrow.d.ts +1 -1
- package/dist/canvas/components/Edges/shared/primitives/EdgeArrow.d.ts.map +1 -1
- package/dist/canvas/components/Edges/shared/primitives/EdgeArrow.js +4 -3
- package/dist/canvas/components/Edges/shared/primitives/EdgeLabel.cjs +3 -3
- package/dist/canvas/components/Edges/shared/primitives/EdgeLabel.d.ts +2 -2
- package/dist/canvas/components/Edges/shared/primitives/EdgeLabel.d.ts.map +1 -1
- package/dist/canvas/components/Edges/shared/primitives/EdgeLabel.js +4 -4
- package/dist/canvas/components/Edges/shared/primitives/EdgePath.cjs +4 -3
- package/dist/canvas/components/Edges/shared/primitives/EdgePath.d.ts +2 -2
- package/dist/canvas/components/Edges/shared/primitives/EdgePath.d.ts.map +1 -1
- package/dist/canvas/components/Edges/shared/primitives/EdgePath.js +4 -3
- package/dist/canvas/components/Edges/shared/types.d.ts +5 -0
- package/dist/canvas/components/Edges/shared/types.d.ts.map +1 -1
- package/dist/canvas/components/Toolbox/SearchBox.cjs +2 -1
- package/dist/canvas/components/Toolbox/SearchBox.d.ts +1 -0
- package/dist/canvas/components/Toolbox/SearchBox.d.ts.map +1 -1
- package/dist/canvas/components/Toolbox/SearchBox.js +2 -1
- package/dist/canvas/components/Toolbox/Toolbox.cjs +5 -0
- package/dist/canvas/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/canvas/components/Toolbox/Toolbox.js +5 -0
- package/dist/canvas/locales/en.cjs +1 -1
- package/dist/canvas/locales/en.d.ts.map +1 -1
- package/dist/canvas/locales/en.js +1 -1
- package/dist/canvas/storybook-utils/components/StoryPage.d.ts +36 -0
- package/dist/canvas/storybook-utils/components/StoryPage.d.ts.map +1 -0
- package/dist/canvas/storybook-utils/components/StoryPreview.d.ts +9 -0
- package/dist/canvas/storybook-utils/components/StoryPreview.d.ts.map +1 -0
- package/dist/canvas/storybook-utils/components/StorySpecTable.d.ts +14 -0
- package/dist/canvas/storybook-utils/components/StorySpecTable.d.ts.map +1 -0
- package/dist/canvas/storybook-utils/components/index.d.ts +3 -0
- package/dist/canvas/storybook-utils/components/index.d.ts.map +1 -1
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/material/components/ap-model-picker/locales/de.cjs +1 -1
- package/dist/material/components/ap-model-picker/locales/de.d.ts.map +1 -1
- package/dist/material/components/ap-model-picker/locales/de.js +1 -1
- package/dist/material/components/ap-model-picker/locales/es-MX.cjs +1 -1
- package/dist/material/components/ap-model-picker/locales/es-MX.d.ts.map +1 -1
- package/dist/material/components/ap-model-picker/locales/es-MX.js +1 -1
- package/dist/material/components/ap-model-picker/locales/es.cjs +1 -1
- package/dist/material/components/ap-model-picker/locales/es.d.ts.map +1 -1
- package/dist/material/components/ap-model-picker/locales/es.js +1 -1
- package/dist/material/components/ap-model-picker/locales/fr.cjs +1 -1
- package/dist/material/components/ap-model-picker/locales/fr.d.ts.map +1 -1
- package/dist/material/components/ap-model-picker/locales/fr.js +1 -1
- package/dist/material/components/ap-model-picker/locales/ja.cjs +1 -1
- package/dist/material/components/ap-model-picker/locales/ja.d.ts.map +1 -1
- package/dist/material/components/ap-model-picker/locales/ja.js +1 -1
- package/dist/material/components/ap-model-picker/locales/ko.cjs +1 -1
- package/dist/material/components/ap-model-picker/locales/ko.d.ts.map +1 -1
- package/dist/material/components/ap-model-picker/locales/ko.js +1 -1
- package/dist/material/components/ap-model-picker/locales/pt-BR.cjs +1 -1
- package/dist/material/components/ap-model-picker/locales/pt-BR.d.ts.map +1 -1
- package/dist/material/components/ap-model-picker/locales/pt-BR.js +1 -1
- package/dist/material/components/ap-model-picker/locales/pt.cjs +1 -1
- package/dist/material/components/ap-model-picker/locales/pt.d.ts.map +1 -1
- package/dist/material/components/ap-model-picker/locales/pt.js +1 -1
- package/dist/material/components/ap-model-picker/locales/ro.cjs +1 -1
- package/dist/material/components/ap-model-picker/locales/ro.d.ts.map +1 -1
- package/dist/material/components/ap-model-picker/locales/ro.js +1 -1
- package/dist/material/components/ap-model-picker/locales/tr.cjs +1 -1
- package/dist/material/components/ap-model-picker/locales/tr.d.ts.map +1 -1
- package/dist/material/components/ap-model-picker/locales/tr.js +1 -1
- package/dist/material/components/ap-model-picker/locales/zh-CN.cjs +1 -1
- package/dist/material/components/ap-model-picker/locales/zh-CN.d.ts.map +1 -1
- package/dist/material/components/ap-model-picker/locales/zh-CN.js +1 -1
- package/dist/material/components/ap-model-picker/locales/zh-TW.cjs +1 -1
- package/dist/material/components/ap-model-picker/locales/zh-TW.d.ts.map +1 -1
- package/dist/material/components/ap-model-picker/locales/zh-TW.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crossings.d.ts","sourceRoot":"","sources":["../../../../../../src/canvas/components/Edges/shared/crossings/crossings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKhD,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IAEf,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB,CAAC;AA0CF,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAmFnF;AAmBD,wBAAgB,cAAc,CAAC,CAAC,EAAE,SAAS,KAAK,EAAE,EAAE,CAAC,EAAE,SAAS,KAAK,EAAE,GAAG,OAAO,CAUhF;AAGD,wBAAgB,UAAU,CAAC,CAAC,EAAE,SAAS,QAAQ,EAAE,EAAE,CAAC,EAAE,SAAS,QAAQ,EAAE,GAAG,OAAO,CAWlF"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { EDGE_CONSTANTS } from "../constants.js";
|
|
2
|
+
const { COLLINEAR_TOLERANCE: TOL, BORDER_RADIUS } = EDGE_CONSTANTS;
|
|
3
|
+
function computeLineJumps(polylines) {
|
|
4
|
+
const horizontals = [];
|
|
5
|
+
const verticals = [];
|
|
6
|
+
for (const { edgeId, points } of polylines)for(let i = 0; i < points.length - 1; i++){
|
|
7
|
+
const a = points[i];
|
|
8
|
+
const b = points[i + 1];
|
|
9
|
+
const dx = Math.abs(b.x - a.x);
|
|
10
|
+
const dy = Math.abs(b.y - a.y);
|
|
11
|
+
if (dy <= TOL && dx > TOL) horizontals.push({
|
|
12
|
+
edgeId,
|
|
13
|
+
segmentIndex: i,
|
|
14
|
+
y: a.y,
|
|
15
|
+
xMin: Math.min(a.x, b.x),
|
|
16
|
+
xMax: Math.max(a.x, b.x)
|
|
17
|
+
});
|
|
18
|
+
else if (dx <= TOL && dy > TOL) {
|
|
19
|
+
const bendMargin = Math.min(BORDER_RADIUS, dy / 2);
|
|
20
|
+
const startMargin = i > 0 ? bendMargin : TOL;
|
|
21
|
+
const endMargin = i + 2 < points.length ? bendMargin : TOL;
|
|
22
|
+
const descending = b.y > a.y;
|
|
23
|
+
verticals.push({
|
|
24
|
+
edgeId,
|
|
25
|
+
x: a.x,
|
|
26
|
+
yMin: Math.min(a.y, b.y),
|
|
27
|
+
yMax: Math.max(a.y, b.y),
|
|
28
|
+
minMargin: descending ? startMargin : endMargin,
|
|
29
|
+
maxMargin: descending ? endMargin : startMargin
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (0 === horizontals.length || 0 === verticals.length) return new Map();
|
|
34
|
+
verticals.sort((a, b)=>a.x - b.x);
|
|
35
|
+
const xs = verticals.map((v)=>v.x);
|
|
36
|
+
const result = new Map();
|
|
37
|
+
for (const h of horizontals){
|
|
38
|
+
let jumps;
|
|
39
|
+
let lastX = -1 / 0;
|
|
40
|
+
for(let i = lowerBound(xs, h.xMin + TOL); i < verticals.length; i++){
|
|
41
|
+
const v = verticals[i];
|
|
42
|
+
if (v.x >= h.xMax - TOL) break;
|
|
43
|
+
if (v.edgeId !== h.edgeId) {
|
|
44
|
+
if (!(h.y <= v.yMin + v.minMargin) && !(h.y >= v.yMax - v.maxMargin)) {
|
|
45
|
+
if (!(v.x - lastX <= TOL)) {
|
|
46
|
+
lastX = v.x;
|
|
47
|
+
jumps ??= [];
|
|
48
|
+
jumps.push({
|
|
49
|
+
segmentIndex: h.segmentIndex,
|
|
50
|
+
point: {
|
|
51
|
+
x: v.x,
|
|
52
|
+
y: h.y
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (!jumps) continue;
|
|
60
|
+
const existing = result.get(h.edgeId);
|
|
61
|
+
if (existing) existing.push(...jumps);
|
|
62
|
+
else result.set(h.edgeId, jumps);
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
function lowerBound(sorted, value) {
|
|
67
|
+
let low = 0;
|
|
68
|
+
let high = sorted.length;
|
|
69
|
+
while(low < high){
|
|
70
|
+
const mid = low + high >>> 1;
|
|
71
|
+
if (sorted[mid] < value) low = mid + 1;
|
|
72
|
+
else high = mid;
|
|
73
|
+
}
|
|
74
|
+
return low;
|
|
75
|
+
}
|
|
76
|
+
function polylinesEqual(a, b) {
|
|
77
|
+
if (a === b) return true;
|
|
78
|
+
if (a.length !== b.length) return false;
|
|
79
|
+
for(let i = 0; i < a.length; i++){
|
|
80
|
+
const left = a[i];
|
|
81
|
+
const right = b[i];
|
|
82
|
+
if (Math.abs(left.x - right.x) > TOL) return false;
|
|
83
|
+
if (Math.abs(left.y - right.y) > TOL) return false;
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
function jumpsEqual(a, b) {
|
|
88
|
+
if (a === b) return true;
|
|
89
|
+
if (a.length !== b.length) return false;
|
|
90
|
+
for(let i = 0; i < a.length; i++){
|
|
91
|
+
const left = a[i];
|
|
92
|
+
const right = b[i];
|
|
93
|
+
if (left.segmentIndex !== right.segmentIndex) return false;
|
|
94
|
+
if (Math.abs(left.point.x - right.point.x) > TOL) return false;
|
|
95
|
+
if (Math.abs(left.point.y - right.point.y) > TOL) return false;
|
|
96
|
+
}
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
export { computeLineJumps, jumpsEqual, polylinesEqual };
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
EdgeCrossingsStore: ()=>external_EdgeCrossingsContext_cjs_namespaceObject.EdgeCrossingsStore,
|
|
28
|
+
EdgeCrossingsProvider: ()=>external_EdgeCrossingsContext_cjs_namespaceObject.EdgeCrossingsProvider,
|
|
29
|
+
useEdgeLineJumps: ()=>external_useEdgeLineJumps_cjs_namespaceObject.useEdgeLineJumps,
|
|
30
|
+
jumpsEqual: ()=>external_crossings_cjs_namespaceObject.jumpsEqual,
|
|
31
|
+
computeLineJumps: ()=>external_crossings_cjs_namespaceObject.computeLineJumps
|
|
32
|
+
});
|
|
33
|
+
const external_crossings_cjs_namespaceObject = require("./crossings.cjs");
|
|
34
|
+
const external_EdgeCrossingsContext_cjs_namespaceObject = require("./EdgeCrossingsContext.cjs");
|
|
35
|
+
const external_useEdgeLineJumps_cjs_namespaceObject = require("./useEdgeLineJumps.cjs");
|
|
36
|
+
exports.EdgeCrossingsProvider = __webpack_exports__.EdgeCrossingsProvider;
|
|
37
|
+
exports.EdgeCrossingsStore = __webpack_exports__.EdgeCrossingsStore;
|
|
38
|
+
exports.computeLineJumps = __webpack_exports__.computeLineJumps;
|
|
39
|
+
exports.jumpsEqual = __webpack_exports__.jumpsEqual;
|
|
40
|
+
exports.useEdgeLineJumps = __webpack_exports__.useEdgeLineJumps;
|
|
41
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
42
|
+
"EdgeCrossingsProvider",
|
|
43
|
+
"EdgeCrossingsStore",
|
|
44
|
+
"computeLineJumps",
|
|
45
|
+
"jumpsEqual",
|
|
46
|
+
"useEdgeLineJumps"
|
|
47
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
48
|
+
Object.defineProperty(exports, '__esModule', {
|
|
49
|
+
value: true
|
|
50
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/canvas/components/Edges/shared/crossings/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { computeLineJumps, jumpsEqual } from "./crossings.js";
|
|
2
|
+
import { EdgeCrossingsProvider, EdgeCrossingsStore } from "./EdgeCrossingsContext.js";
|
|
3
|
+
import { useEdgeLineJumps } from "./useEdgeLineJumps.js";
|
|
4
|
+
export { EdgeCrossingsProvider, EdgeCrossingsStore, computeLineJumps, jumpsEqual, useEdgeLineJumps };
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
useEdgeLineJumps: ()=>useEdgeLineJumps
|
|
28
|
+
});
|
|
29
|
+
const external_react_namespaceObject = require("react");
|
|
30
|
+
const external_EdgeCrossingsContext_cjs_namespaceObject = require("./EdgeCrossingsContext.cjs");
|
|
31
|
+
function useEdgeLineJumps(edgeId, points, enabled) {
|
|
32
|
+
const store = (0, external_EdgeCrossingsContext_cjs_namespaceObject.useEdgeCrossingsStore)();
|
|
33
|
+
(0, external_react_namespaceObject.useLayoutEffect)(()=>{
|
|
34
|
+
if (store && enabled) store.register(edgeId, points);
|
|
35
|
+
}, [
|
|
36
|
+
store,
|
|
37
|
+
enabled,
|
|
38
|
+
edgeId,
|
|
39
|
+
points
|
|
40
|
+
]);
|
|
41
|
+
(0, external_react_namespaceObject.useLayoutEffect)(()=>{
|
|
42
|
+
if (!store || !enabled) return;
|
|
43
|
+
return ()=>store.unregister(edgeId);
|
|
44
|
+
}, [
|
|
45
|
+
store,
|
|
46
|
+
enabled,
|
|
47
|
+
edgeId
|
|
48
|
+
]);
|
|
49
|
+
const subscribe = (0, external_react_namespaceObject.useCallback)((onStoreChange)=>store && enabled ? store.subscribe(edgeId, onStoreChange) : ()=>{}, [
|
|
50
|
+
store,
|
|
51
|
+
enabled,
|
|
52
|
+
edgeId
|
|
53
|
+
]);
|
|
54
|
+
const getSnapshot = (0, external_react_namespaceObject.useCallback)(()=>store && enabled ? store.getSnapshot(edgeId) : external_EdgeCrossingsContext_cjs_namespaceObject.EMPTY_JUMPS, [
|
|
55
|
+
store,
|
|
56
|
+
enabled,
|
|
57
|
+
edgeId
|
|
58
|
+
]);
|
|
59
|
+
return (0, external_react_namespaceObject.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
60
|
+
}
|
|
61
|
+
exports.useEdgeLineJumps = __webpack_exports__.useEdgeLineJumps;
|
|
62
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
63
|
+
"useEdgeLineJumps"
|
|
64
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
65
|
+
Object.defineProperty(exports, '__esModule', {
|
|
66
|
+
value: true
|
|
67
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEdgeLineJumps.d.ts","sourceRoot":"","sources":["../../../../../../src/canvas/components/Edges/shared/crossings/useEdgeLineJumps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAkBhD,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,KAAK,EAAE,EACf,OAAO,EAAE,OAAO,GACf,SAAS,QAAQ,EAAE,CA8BrB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useCallback, useLayoutEffect, useSyncExternalStore } from "react";
|
|
2
|
+
import { EMPTY_JUMPS, useEdgeCrossingsStore } from "./EdgeCrossingsContext.js";
|
|
3
|
+
function useEdgeLineJumps(edgeId, points, enabled) {
|
|
4
|
+
const store = useEdgeCrossingsStore();
|
|
5
|
+
useLayoutEffect(()=>{
|
|
6
|
+
if (store && enabled) store.register(edgeId, points);
|
|
7
|
+
}, [
|
|
8
|
+
store,
|
|
9
|
+
enabled,
|
|
10
|
+
edgeId,
|
|
11
|
+
points
|
|
12
|
+
]);
|
|
13
|
+
useLayoutEffect(()=>{
|
|
14
|
+
if (!store || !enabled) return;
|
|
15
|
+
return ()=>store.unregister(edgeId);
|
|
16
|
+
}, [
|
|
17
|
+
store,
|
|
18
|
+
enabled,
|
|
19
|
+
edgeId
|
|
20
|
+
]);
|
|
21
|
+
const subscribe = useCallback((onStoreChange)=>store && enabled ? store.subscribe(edgeId, onStoreChange) : ()=>{}, [
|
|
22
|
+
store,
|
|
23
|
+
enabled,
|
|
24
|
+
edgeId
|
|
25
|
+
]);
|
|
26
|
+
const getSnapshot = useCallback(()=>store && enabled ? store.getSnapshot(edgeId) : EMPTY_JUMPS, [
|
|
27
|
+
store,
|
|
28
|
+
enabled,
|
|
29
|
+
edgeId
|
|
30
|
+
]);
|
|
31
|
+
return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
32
|
+
}
|
|
33
|
+
export { useEdgeLineJumps };
|
|
@@ -364,59 +364,98 @@ function extractSegments(pathPoints) {
|
|
|
364
364
|
}
|
|
365
365
|
return segments;
|
|
366
366
|
}
|
|
367
|
-
function createRoundedPath(points, borderRadius = BORDER_RADIUS) {
|
|
367
|
+
function createRoundedPath(points, borderRadius = BORDER_RADIUS, jumps = []) {
|
|
368
368
|
if (points.length < 2) return '';
|
|
369
369
|
const firstPoint = points[0];
|
|
370
|
+
const lastPoint = points[points.length - 1];
|
|
370
371
|
const path = [
|
|
371
372
|
`M ${firstPoint.x} ${firstPoint.y}`
|
|
372
373
|
];
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
y: curr.y - prev.y
|
|
385
|
-
};
|
|
386
|
-
const v2 = {
|
|
387
|
-
x: next.x - curr.x,
|
|
388
|
-
y: next.y - curr.y
|
|
389
|
-
};
|
|
390
|
-
const len1 = Math.sqrt(v1.x * v1.x + v1.y * v1.y);
|
|
391
|
-
const len2 = Math.sqrt(v2.x * v2.x + v2.y * v2.y);
|
|
392
|
-
const radius = Math.min(borderRadius, Math.min(len1, len2) / 2);
|
|
393
|
-
if (radius < 1) {
|
|
394
|
-
path.push(`L ${curr.x} ${curr.y}`);
|
|
395
|
-
continue;
|
|
374
|
+
const corners = [];
|
|
375
|
+
for(let i = 1; i < points.length - 1; i++)corners[i] = buildCorner(points[i - 1], points[i], points[i + 1], borderRadius);
|
|
376
|
+
const jumpsBySegment = groupJumpsBySegment(jumps);
|
|
377
|
+
for(let i = 0; i < points.length - 1; i++){
|
|
378
|
+
const from = 0 === i ? firstPoint : corners[i].end;
|
|
379
|
+
const to = i === points.length - 2 ? lastPoint : corners[i + 1].start;
|
|
380
|
+
appendRun(path, from, to, jumpsBySegment?.get(i));
|
|
381
|
+
const corner = corners[i + 1];
|
|
382
|
+
if (corner?.rounded) {
|
|
383
|
+
const vertex = points[i + 1];
|
|
384
|
+
path.push(`Q ${vertex.x} ${vertex.y} ${corner.end.x} ${corner.end.y}`);
|
|
396
385
|
}
|
|
397
|
-
const n1 = {
|
|
398
|
-
x: v1.x / len1,
|
|
399
|
-
y: v1.y / len1
|
|
400
|
-
};
|
|
401
|
-
const n2 = {
|
|
402
|
-
x: v2.x / len2,
|
|
403
|
-
y: v2.y / len2
|
|
404
|
-
};
|
|
405
|
-
const cornerStart = {
|
|
406
|
-
x: curr.x - n1.x * radius,
|
|
407
|
-
y: curr.y - n1.y * radius
|
|
408
|
-
};
|
|
409
|
-
const cornerEnd = {
|
|
410
|
-
x: curr.x + n2.x * radius,
|
|
411
|
-
y: curr.y + n2.y * radius
|
|
412
|
-
};
|
|
413
|
-
path.push(`L ${cornerStart.x} ${cornerStart.y}`);
|
|
414
|
-
path.push(`Q ${curr.x} ${curr.y} ${cornerEnd.x} ${cornerEnd.y}`);
|
|
415
386
|
}
|
|
416
|
-
const lastPoint = points[points.length - 1];
|
|
417
|
-
path.push(`L ${lastPoint.x} ${lastPoint.y}`);
|
|
418
387
|
return path.join(' ');
|
|
419
388
|
}
|
|
389
|
+
function buildCorner(prev, curr, next, borderRadius) {
|
|
390
|
+
const v1 = {
|
|
391
|
+
x: curr.x - prev.x,
|
|
392
|
+
y: curr.y - prev.y
|
|
393
|
+
};
|
|
394
|
+
const v2 = {
|
|
395
|
+
x: next.x - curr.x,
|
|
396
|
+
y: next.y - curr.y
|
|
397
|
+
};
|
|
398
|
+
const len1 = Math.sqrt(v1.x * v1.x + v1.y * v1.y);
|
|
399
|
+
const len2 = Math.sqrt(v2.x * v2.x + v2.y * v2.y);
|
|
400
|
+
const radius = Math.min(borderRadius, Math.min(len1, len2) / 2);
|
|
401
|
+
if (radius < 1) return {
|
|
402
|
+
start: curr,
|
|
403
|
+
end: curr,
|
|
404
|
+
rounded: false
|
|
405
|
+
};
|
|
406
|
+
return {
|
|
407
|
+
start: {
|
|
408
|
+
x: curr.x - v1.x / len1 * radius,
|
|
409
|
+
y: curr.y - v1.y / len1 * radius
|
|
410
|
+
},
|
|
411
|
+
end: {
|
|
412
|
+
x: curr.x + v2.x / len2 * radius,
|
|
413
|
+
y: curr.y + v2.y / len2 * radius
|
|
414
|
+
},
|
|
415
|
+
rounded: true
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
function groupJumpsBySegment(jumps) {
|
|
419
|
+
if (0 === jumps.length) return null;
|
|
420
|
+
const bySegment = new Map();
|
|
421
|
+
for (const jump of jumps){
|
|
422
|
+
const existing = bySegment.get(jump.segmentIndex);
|
|
423
|
+
if (existing) existing.push(jump);
|
|
424
|
+
else bySegment.set(jump.segmentIndex, [
|
|
425
|
+
jump
|
|
426
|
+
]);
|
|
427
|
+
}
|
|
428
|
+
return bySegment;
|
|
429
|
+
}
|
|
430
|
+
function appendRun(path, from, to, jumps) {
|
|
431
|
+
const dx = to.x - from.x;
|
|
432
|
+
const dy = to.y - from.y;
|
|
433
|
+
const length = Math.sqrt(dx * dx + dy * dy);
|
|
434
|
+
const radius = external_constants_cjs_namespaceObject.EDGE_CONSTANTS.LINE_JUMP_RADIUS;
|
|
435
|
+
if (jumps && jumps.length > 0 && length > 2 * radius) {
|
|
436
|
+
const ux = dx / length;
|
|
437
|
+
const uy = dy / length;
|
|
438
|
+
const horizontal = Math.abs(dx) >= Math.abs(dy);
|
|
439
|
+
const sweep = (horizontal ? dx : dy) > 0 ? 1 : 0;
|
|
440
|
+
const distances = jumps.map((jump)=>(jump.point.x - from.x) * ux + (jump.point.y - from.y) * uy).filter((distance)=>distance >= radius && distance <= length - radius).sort((a, b)=>a - b);
|
|
441
|
+
let previous = -1 / 0;
|
|
442
|
+
for (const distance of distances){
|
|
443
|
+
if (distance - previous < 2 * radius) continue;
|
|
444
|
+
previous = distance;
|
|
445
|
+
const entry = {
|
|
446
|
+
x: from.x + ux * (distance - radius),
|
|
447
|
+
y: from.y + uy * (distance - radius)
|
|
448
|
+
};
|
|
449
|
+
const exit = {
|
|
450
|
+
x: from.x + ux * (distance + radius),
|
|
451
|
+
y: from.y + uy * (distance + radius)
|
|
452
|
+
};
|
|
453
|
+
path.push(`L ${entry.x} ${entry.y}`);
|
|
454
|
+
path.push(`A ${radius} ${radius} 0 0 ${sweep} ${exit.x} ${exit.y}`);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
path.push(`L ${to.x} ${to.y}`);
|
|
458
|
+
}
|
|
420
459
|
function getSegmentMidpoint(segment) {
|
|
421
460
|
return {
|
|
422
461
|
x: (segment.start.x + segment.end.x) / 2,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Position } from '../../../xyflow/react.ts';
|
|
2
|
-
import type { PathVertex, Point, Segment, SegmentOrientation, Waypoint } from './types';
|
|
2
|
+
import type { PathJump, PathVertex, Point, Segment, SegmentOrientation, Waypoint } from './types';
|
|
3
3
|
export declare function snapPointToGrid(point: Point): Point;
|
|
4
4
|
export declare function isHorizontalPosition(position: Position): boolean;
|
|
5
5
|
export declare function calculateAutoWaypoints(sourceX: number, sourceY: number, sourcePosition: Position, targetX: number, targetY: number, targetPosition: Position): Point[];
|
|
@@ -12,7 +12,7 @@ export declare function isSegmentPerpendicular(segment: {
|
|
|
12
12
|
end: Point;
|
|
13
13
|
}): boolean;
|
|
14
14
|
export declare function extractSegments(pathPoints: PathVertex[]): Segment[];
|
|
15
|
-
export declare function createRoundedPath(points: Point[], borderRadius?: number): string;
|
|
15
|
+
export declare function createRoundedPath(points: Point[], borderRadius?: number, jumps?: readonly PathJump[]): string;
|
|
16
16
|
export declare function getSegmentMidpoint(segment: Segment): Point;
|
|
17
17
|
export declare function getSegmentLength(segment: Segment): number;
|
|
18
18
|
export declare function isSegmentInteractable(segment: Segment): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Edges/shared/geometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAGzE,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Edges/shared/geometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAGzE,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIlG,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAEnD;AAmBD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAEhE;AA6BD,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,QAAQ,EACxB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,QAAQ,GACvB,KAAK,EAAE,CAyCT;AAyBD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,EAAE,CAoCjG;AA8DD,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,QAAQ,EACxB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,QAAQ,EACxB,SAAS,GAAE,QAAQ,EAAO,EAE1B,UAAU,UAAQ,GACjB,UAAU,EAAE,CA6Dd;AAiBD,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,KAAK,EAClD,MAAM,EAAE,CAAC,EAAE,EACX,SAAS,EAAE,KAAK,EAChB,OAAO,EAAE,KAAK,EACd,WAAW,GAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAqB,GAC/C,CAAC,EAAE,CAsFL;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,GAAG,kBAAkB,CAElF;AAKD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,KAAK,CAAA;CAAE,GAAG,OAAO,CAIrF;AAUD,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU,EAAE,GAAG,OAAO,EAAE,CAgBnE;AAkBD,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,KAAK,EAAE,EACf,YAAY,GAAE,MAAsB,EACpC,KAAK,GAAE,SAAS,QAAQ,EAAO,GAC9B,MAAM,CA8BR;AA8ED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,KAAK,CAK1D;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAIzD;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAE/D;AAOD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAkCzD"}
|
|
@@ -323,59 +323,98 @@ function extractSegments(pathPoints) {
|
|
|
323
323
|
}
|
|
324
324
|
return segments;
|
|
325
325
|
}
|
|
326
|
-
function createRoundedPath(points, borderRadius = BORDER_RADIUS) {
|
|
326
|
+
function createRoundedPath(points, borderRadius = BORDER_RADIUS, jumps = []) {
|
|
327
327
|
if (points.length < 2) return '';
|
|
328
328
|
const firstPoint = points[0];
|
|
329
|
+
const lastPoint = points[points.length - 1];
|
|
329
330
|
const path = [
|
|
330
331
|
`M ${firstPoint.x} ${firstPoint.y}`
|
|
331
332
|
];
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
y: curr.y - prev.y
|
|
344
|
-
};
|
|
345
|
-
const v2 = {
|
|
346
|
-
x: next.x - curr.x,
|
|
347
|
-
y: next.y - curr.y
|
|
348
|
-
};
|
|
349
|
-
const len1 = Math.sqrt(v1.x * v1.x + v1.y * v1.y);
|
|
350
|
-
const len2 = Math.sqrt(v2.x * v2.x + v2.y * v2.y);
|
|
351
|
-
const radius = Math.min(borderRadius, Math.min(len1, len2) / 2);
|
|
352
|
-
if (radius < 1) {
|
|
353
|
-
path.push(`L ${curr.x} ${curr.y}`);
|
|
354
|
-
continue;
|
|
333
|
+
const corners = [];
|
|
334
|
+
for(let i = 1; i < points.length - 1; i++)corners[i] = buildCorner(points[i - 1], points[i], points[i + 1], borderRadius);
|
|
335
|
+
const jumpsBySegment = groupJumpsBySegment(jumps);
|
|
336
|
+
for(let i = 0; i < points.length - 1; i++){
|
|
337
|
+
const from = 0 === i ? firstPoint : corners[i].end;
|
|
338
|
+
const to = i === points.length - 2 ? lastPoint : corners[i + 1].start;
|
|
339
|
+
appendRun(path, from, to, jumpsBySegment?.get(i));
|
|
340
|
+
const corner = corners[i + 1];
|
|
341
|
+
if (corner?.rounded) {
|
|
342
|
+
const vertex = points[i + 1];
|
|
343
|
+
path.push(`Q ${vertex.x} ${vertex.y} ${corner.end.x} ${corner.end.y}`);
|
|
355
344
|
}
|
|
356
|
-
const n1 = {
|
|
357
|
-
x: v1.x / len1,
|
|
358
|
-
y: v1.y / len1
|
|
359
|
-
};
|
|
360
|
-
const n2 = {
|
|
361
|
-
x: v2.x / len2,
|
|
362
|
-
y: v2.y / len2
|
|
363
|
-
};
|
|
364
|
-
const cornerStart = {
|
|
365
|
-
x: curr.x - n1.x * radius,
|
|
366
|
-
y: curr.y - n1.y * radius
|
|
367
|
-
};
|
|
368
|
-
const cornerEnd = {
|
|
369
|
-
x: curr.x + n2.x * radius,
|
|
370
|
-
y: curr.y + n2.y * radius
|
|
371
|
-
};
|
|
372
|
-
path.push(`L ${cornerStart.x} ${cornerStart.y}`);
|
|
373
|
-
path.push(`Q ${curr.x} ${curr.y} ${cornerEnd.x} ${cornerEnd.y}`);
|
|
374
345
|
}
|
|
375
|
-
const lastPoint = points[points.length - 1];
|
|
376
|
-
path.push(`L ${lastPoint.x} ${lastPoint.y}`);
|
|
377
346
|
return path.join(' ');
|
|
378
347
|
}
|
|
348
|
+
function buildCorner(prev, curr, next, borderRadius) {
|
|
349
|
+
const v1 = {
|
|
350
|
+
x: curr.x - prev.x,
|
|
351
|
+
y: curr.y - prev.y
|
|
352
|
+
};
|
|
353
|
+
const v2 = {
|
|
354
|
+
x: next.x - curr.x,
|
|
355
|
+
y: next.y - curr.y
|
|
356
|
+
};
|
|
357
|
+
const len1 = Math.sqrt(v1.x * v1.x + v1.y * v1.y);
|
|
358
|
+
const len2 = Math.sqrt(v2.x * v2.x + v2.y * v2.y);
|
|
359
|
+
const radius = Math.min(borderRadius, Math.min(len1, len2) / 2);
|
|
360
|
+
if (radius < 1) return {
|
|
361
|
+
start: curr,
|
|
362
|
+
end: curr,
|
|
363
|
+
rounded: false
|
|
364
|
+
};
|
|
365
|
+
return {
|
|
366
|
+
start: {
|
|
367
|
+
x: curr.x - v1.x / len1 * radius,
|
|
368
|
+
y: curr.y - v1.y / len1 * radius
|
|
369
|
+
},
|
|
370
|
+
end: {
|
|
371
|
+
x: curr.x + v2.x / len2 * radius,
|
|
372
|
+
y: curr.y + v2.y / len2 * radius
|
|
373
|
+
},
|
|
374
|
+
rounded: true
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
function groupJumpsBySegment(jumps) {
|
|
378
|
+
if (0 === jumps.length) return null;
|
|
379
|
+
const bySegment = new Map();
|
|
380
|
+
for (const jump of jumps){
|
|
381
|
+
const existing = bySegment.get(jump.segmentIndex);
|
|
382
|
+
if (existing) existing.push(jump);
|
|
383
|
+
else bySegment.set(jump.segmentIndex, [
|
|
384
|
+
jump
|
|
385
|
+
]);
|
|
386
|
+
}
|
|
387
|
+
return bySegment;
|
|
388
|
+
}
|
|
389
|
+
function appendRun(path, from, to, jumps) {
|
|
390
|
+
const dx = to.x - from.x;
|
|
391
|
+
const dy = to.y - from.y;
|
|
392
|
+
const length = Math.sqrt(dx * dx + dy * dy);
|
|
393
|
+
const radius = EDGE_CONSTANTS.LINE_JUMP_RADIUS;
|
|
394
|
+
if (jumps && jumps.length > 0 && length > 2 * radius) {
|
|
395
|
+
const ux = dx / length;
|
|
396
|
+
const uy = dy / length;
|
|
397
|
+
const horizontal = Math.abs(dx) >= Math.abs(dy);
|
|
398
|
+
const sweep = (horizontal ? dx : dy) > 0 ? 1 : 0;
|
|
399
|
+
const distances = jumps.map((jump)=>(jump.point.x - from.x) * ux + (jump.point.y - from.y) * uy).filter((distance)=>distance >= radius && distance <= length - radius).sort((a, b)=>a - b);
|
|
400
|
+
let previous = -1 / 0;
|
|
401
|
+
for (const distance of distances){
|
|
402
|
+
if (distance - previous < 2 * radius) continue;
|
|
403
|
+
previous = distance;
|
|
404
|
+
const entry = {
|
|
405
|
+
x: from.x + ux * (distance - radius),
|
|
406
|
+
y: from.y + uy * (distance - radius)
|
|
407
|
+
};
|
|
408
|
+
const exit = {
|
|
409
|
+
x: from.x + ux * (distance + radius),
|
|
410
|
+
y: from.y + uy * (distance + radius)
|
|
411
|
+
};
|
|
412
|
+
path.push(`L ${entry.x} ${entry.y}`);
|
|
413
|
+
path.push(`A ${radius} ${radius} 0 0 ${sweep} ${exit.x} ${exit.y}`);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
path.push(`L ${to.x} ${to.y}`);
|
|
417
|
+
}
|
|
379
418
|
function getSegmentMidpoint(segment) {
|
|
380
419
|
return {
|
|
381
420
|
x: (segment.start.x + segment.end.x) / 2,
|
|
@@ -29,11 +29,12 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29
29
|
const external_react_namespaceObject = require("react");
|
|
30
30
|
const index_cjs_namespaceObject = require("../../../../hooks/index.cjs");
|
|
31
31
|
const external_constants_cjs_namespaceObject = require("../constants.cjs");
|
|
32
|
+
const external_crossings_index_cjs_namespaceObject = require("../crossings/index.cjs");
|
|
32
33
|
const external_geometry_cjs_namespaceObject = require("../geometry.cjs");
|
|
33
34
|
const EMPTY_VERTICES = [];
|
|
34
35
|
const EMPTY_SEGMENTS = [];
|
|
35
36
|
function useEdgeGeometry(args) {
|
|
36
|
-
const { routing, sourceNodeId, targetNodeId, sourceHandleId, targetHandleId, sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition, waypoints, autoRouted = false, enableSegments = true, hideArrowHead = false } = args;
|
|
37
|
+
const { routing, edgeId, sourceNodeId, targetNodeId, sourceHandleId, targetHandleId, sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition, waypoints, autoRouted = false, enableSegments = true, hideArrowHead = false, enableLineJumps = false } = args;
|
|
37
38
|
const arrowOffset = external_constants_cjs_namespaceObject.ARROW_OFFSETS[targetPosition];
|
|
38
39
|
const isWaypoint = 'waypoint' === routing;
|
|
39
40
|
const isHandle = 'handle' === routing;
|
|
@@ -52,8 +53,10 @@ function useEdgeGeometry(args) {
|
|
|
52
53
|
enableSegments,
|
|
53
54
|
pathPoints
|
|
54
55
|
]);
|
|
55
|
-
const
|
|
56
|
-
|
|
56
|
+
const jumps = (0, external_crossings_index_cjs_namespaceObject.useEdgeLineJumps)(edgeId, pathPoints, isWaypoint && enableLineJumps);
|
|
57
|
+
const waypointPath = (0, external_react_namespaceObject.useMemo)(()=>(0, external_geometry_cjs_namespaceObject.createRoundedPath)(pathPoints, external_constants_cjs_namespaceObject.EDGE_CONSTANTS.BORDER_RADIUS, jumps), [
|
|
58
|
+
pathPoints,
|
|
59
|
+
jumps
|
|
57
60
|
]);
|
|
58
61
|
const handle = (0, index_cjs_namespaceObject.useEdgePath)({
|
|
59
62
|
sourceNodeId: isHandle ? sourceNodeId : '',
|
|
@@ -2,6 +2,7 @@ import type { Position } from '../../../../xyflow/react.ts';
|
|
|
2
2
|
import type { EdgeRouting, PathVertex, Point, Segment, Waypoint } from '../types';
|
|
3
3
|
export type UseEdgeGeometryArgs = {
|
|
4
4
|
routing: EdgeRouting;
|
|
5
|
+
edgeId: string;
|
|
5
6
|
sourceNodeId: string;
|
|
6
7
|
targetNodeId: string;
|
|
7
8
|
sourceHandleId?: string | null;
|
|
@@ -16,6 +17,7 @@ export type UseEdgeGeometryArgs = {
|
|
|
16
17
|
autoRouted?: boolean;
|
|
17
18
|
enableSegments?: boolean;
|
|
18
19
|
hideArrowHead?: boolean;
|
|
20
|
+
enableLineJumps?: boolean;
|
|
19
21
|
};
|
|
20
22
|
export type EdgeGeometry = {
|
|
21
23
|
edgePath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEdgeGeometry.d.ts","sourceRoot":"","sources":["../../../../../../src/canvas/components/Edges/shared/hooks/useEdgeGeometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"useEdgeGeometry.d.ts","sourceRoot":"","sources":["../../../../../../src/canvas/components/Edges/shared/hooks/useEdgeGeometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAWzE,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAKlF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,WAAW,CAAC;IAErB,MAAM,EAAE,MAAM,CAAC;IAEf,YAAY,EAAE,MAAM,CAAC;IAErB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,QAAQ,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,QAAQ,CAAC;IAMzB,SAAS,EAAE,QAAQ,EAAE,CAAC;IAKtB,UAAU,CAAC,EAAE,OAAO,CAAC;IAMrB,cAAc,CAAC,EAAE,OAAO,CAAC;IAMzB,aAAa,CAAC,EAAE,OAAO,CAAC;IAMxB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IAEzB,QAAQ,EAAE,MAAM,CAAC;IAEjB,UAAU,EAAE,UAAU,EAAE,CAAC;IAEzB,QAAQ,EAAE,OAAO,EAAE,CAAC;IAEpB,UAAU,EAAE,KAAK,CAAC;IAElB,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,KAAK,CAAC;KACf,CAAC;CACH,CAAC;AAUF,wBAAgB,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,YAAY,CAwGvE"}
|