Skip to content

Commit

Permalink
Update Data.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
daoauth committed Jan 13, 2025
1 parent 910798b commit a360a22
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions packages/ptb-builder/src/ptbFlow/edges/Data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,11 @@ export const Data = ({
}: EdgeProps) => {
const { colorMode } = useStateContext();

const EXTEND_LENGTH = 10;

const extendHorizontal = (
x1: number,
x2: number,
length: number,
): { startX: number; endX: number } => {
if (x1 < x2) {
return { startX: x1 - length, endX: x2 + length };
} else {
return { startX: x1 + length, endX: x2 - length };
}
};

const { startX: extendedSourceX, endX: extendedTargetX } = extendHorizontal(
sourceX,
targetX,
EXTEND_LENGTH,
);

const [edgePath] = getBezierPath({
sourceX: extendedSourceX,
sourceX: sourceX - 10,
sourceY,
sourcePosition,
targetX: extendedTargetX,
targetX: targetX + 10,
targetY,
targetPosition,
});
Expand Down

0 comments on commit a360a22

Please sign in to comment.