Skip to content

Commit

Permalink
fix(layouts.PortLabel): center the position of oriented outside/insid…
Browse files Browse the repository at this point in the history
…e labels, remove redundant code from manual layout (#2036)
  • Loading branch information
kumilingus authored Feb 14, 2023
1 parent f9dd510 commit 93a1c20
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/layout/ports/portLabel.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,31 @@ function outsideLayout(portPosition, elBBox, autoOrient, opt) {
ty = 0;
textAnchor = 'start';
} else if (angle < x[0]) {
y = '0';
tx = 0;
ty = -offset;
if (autoOrient) {
orientAngle = -90;
textAnchor = 'start';
y = '.3em';
} else {
textAnchor = 'middle';
y = '0';
}
} else if (angle < x[3]) {
y = '.3em';
tx = -offset;
ty = 0;
textAnchor = 'end';
} else {
y = '.6em';
tx = 0;
ty = offset;
if (autoOrient) {
orientAngle = 90;
textAnchor = 'start';
y = '.3em';
} else {
textAnchor = 'middle';
y = '.6em';
}
}

Expand Down Expand Up @@ -101,29 +103,31 @@ function insideLayout(portPosition, elBBox, autoOrient, opt) {
ty = 0;
textAnchor = 'end';
} else if (angle < bBoxAngles[0]) {
y = '.6em';
tx = 0;
ty = offset;
if (autoOrient) {
orientAngle = 90;
textAnchor = 'start';
y = '.3em';
} else {
textAnchor = 'middle';
y = '.6em';
}
} else if (angle < bBoxAngles[3]) {
y = '.3em';
tx = offset;
ty = 0;
textAnchor = 'start';
} else {
y = '0em';
tx = 0;
ty = -offset;
if (autoOrient) {
orientAngle = -90;
textAnchor = 'start';
y = '.3em';
} else {
textAnchor = 'middle';
y = '0';
}
}

Expand Down Expand Up @@ -182,8 +186,8 @@ function radialLayout(portCenterOffset, autoOrient, opt) {
});
}

export const manual = function(portPosition, elBBox, opt) {
return labelAttributes(opt, elBBox);
export const manual = function(_portPosition, _elBBox, opt) {
return labelAttributes(opt);
};

export const left = function(portPosition, elBBox, opt) {
Expand Down

0 comments on commit 93a1c20

Please sign in to comment.