fixed handle connections

This commit is contained in:
peterkogo
2024-02-27 16:54:21 +01:00
parent 14516ab061
commit 83e0a333b0
4 changed files with 24 additions and 10 deletions
+5
View File
@@ -223,9 +223,14 @@ svg.xy-flow__connectionline {
min-width: 5px;
min-height: 5px;
&.connecting {
pointer-events: all;
}
&.connectionindicator {
pointer-events: all;
cursor: crosshair;
background: green;
}
&-bottom {
+2 -2
View File
@@ -38,7 +38,7 @@ export function getClosestHandle(
let closestHandles: ConnectionHandle[] = [];
let minDistance = Infinity;
handles.forEach((handle) => {
for (const handle of handles) {
const distance = Math.sqrt(Math.pow(handle.x - pos.x, 2) + Math.pow(handle.y - pos.y, 2));
if (distance <= connectionRadius) {
if (distance < minDistance) {
@@ -49,7 +49,7 @@ export function getClosestHandle(
}
minDistance = distance;
}
});
}
if (!closestHandles.length) {
return null;