Skip to content

Commit

Permalink
fix: self relationship #363
Browse files Browse the repository at this point in the history
  • Loading branch information
dineug committed Oct 31, 2024
1 parent 5f4da4b commit 2064697
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/erd-editor/src/utils/draw-relationship/pathFinding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export function getRelationshipPath(
}

function getPath(
start: RelationshipPoint,
end: RelationshipPoint
start: Relationship['start'],
end: Relationship['end']
): RelationshipPath['path'] {
const line: PathLine = {
start: {
Expand All @@ -44,6 +44,15 @@ function getPath(
L: { x: 0, y: 0 },
Q: { x: 0, y: 0 },
d() {
if (start.tableId === end.tableId) {
return [
[
{ x: this.M.x, y: this.M.y },
{ x: this.L.x, y: this.L.y },
],
];
}

const distanceX = this.M.x - this.L.x;
const distanceY = this.M.y - this.L.y;
const distanceHalfX = distanceX / 2;
Expand Down

0 comments on commit 2064697

Please sign in to comment.