fix: adjust edge position to not overlay handles on select (#6666)
* Fixed edge to start at left and right sides of handle * Fixed neon to be the same size of default handle * Fixed source and targets Y to work on loop edges as well
This commit is contained in:
parent
f14dc092f2
commit
3bb27bb51b
2 changed files with 11 additions and 8 deletions
|
|
@ -21,8 +21,8 @@ export function DefaultEdge({
|
|||
const targetHandleObject = scapeJSONParse(targetHandleId!);
|
||||
|
||||
const sourceXNew =
|
||||
(sourceNode?.position.x ?? 0) + (sourceNode?.measured?.width ?? 0);
|
||||
const targetXNew = targetNode?.position.x ?? 0;
|
||||
(sourceNode?.position.x ?? 0) + (sourceNode?.measured?.width ?? 0) + 7;
|
||||
const targetXNew = (targetNode?.position.x ?? 0) - 7;
|
||||
|
||||
const distance = 200 + 0.1 * ((sourceXNew - targetXNew) / 2);
|
||||
|
||||
|
|
@ -42,15 +42,18 @@ export function DefaultEdge({
|
|||
200 * (1 - zeroOnNegative) +
|
||||
0.3 * Math.abs(sourceY - targetY) * zeroOnNegative;
|
||||
|
||||
const edgePathLoop = `M ${sourceXNew} ${sourceY} C ${sourceXNew + distance} ${sourceY + sourceDistanceY}, ${targetXNew - distance} ${targetY + distanceY}, ${targetXNew} ${targetY}`;
|
||||
const targetYNew = targetY + 1;
|
||||
const sourceYNew = sourceY + 1;
|
||||
|
||||
const edgePathLoop = `M ${sourceXNew} ${sourceYNew} C ${sourceXNew + distance} ${sourceYNew + sourceDistanceY}, ${targetXNew - distance} ${targetYNew + distanceY}, ${targetXNew} ${targetYNew}`;
|
||||
|
||||
const [edgePath] = getBezierPath({
|
||||
sourceX: sourceXNew,
|
||||
sourceY,
|
||||
sourceY: sourceYNew,
|
||||
sourcePosition: Position.Right,
|
||||
targetPosition: Position.Left,
|
||||
targetX: targetXNew,
|
||||
targetY,
|
||||
targetY: targetYNew,
|
||||
});
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ const HandleContent = memo(function HandleContent({
|
|||
styleSheet.textContent = `
|
||||
@keyframes pulseNeon-${nodeId} {
|
||||
0% {
|
||||
box-shadow: 0 0 0 2px hsl(var(--node-ring)),
|
||||
box-shadow: 0 0 0 3px hsl(var(--node-ring)),
|
||||
0 0 2px ${handleColor},
|
||||
0 0 4px ${handleColor},
|
||||
0 0 6px ${handleColor},
|
||||
|
|
@ -62,7 +62,7 @@ const HandleContent = memo(function HandleContent({
|
|||
0 0 20px ${handleColor};
|
||||
}
|
||||
50% {
|
||||
box-shadow: 0 0 0 2px hsl(var(--node-ring)),
|
||||
box-shadow: 0 0 0 3px hsl(var(--node-ring)),
|
||||
0 0 4px ${handleColor},
|
||||
0 0 8px ${handleColor},
|
||||
0 0 12px ${handleColor},
|
||||
|
|
@ -72,7 +72,7 @@ const HandleContent = memo(function HandleContent({
|
|||
0 0 30px ${handleColor};
|
||||
}
|
||||
100% {
|
||||
box-shadow: 0 0 0 2px hsl(var(--node-ring)),
|
||||
box-shadow: 0 0 0 3px hsl(var(--node-ring)),
|
||||
0 0 2px ${handleColor},
|
||||
0 0 4px ${handleColor},
|
||||
0 0 6px ${handleColor},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue