Skip to content

Commit

Permalink
refactor(label): restore direct label set to avoid unnecessary if
Browse files Browse the repository at this point in the history
  • Loading branch information
A0nameless0man committed Nov 7, 2024
1 parent a70819c commit 8126d2f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/label/LabelManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ class LabelManager {
needsUpdateLabelLine = true;
}
else {
label.x = defaultLabelAttr.x;
label.setStyle('x', defaultLabelAttr.style.x);
}

Expand All @@ -373,6 +374,7 @@ class LabelManager {
needsUpdateLabelLine = true;
}
else {
label.y = defaultLabelAttr.y;
label.setStyle('y', defaultLabelAttr.style.y);
}

Expand All @@ -393,16 +395,10 @@ class LabelManager {
if (layoutOption.x != null) {
labelState.x = parsePercent(layoutOption.x, width);
}
else if (isNormal) {
labelState.x = defaultLabelAttr.x;
}

if (layoutOption.y != null) {
labelState.y = parsePercent(layoutOption.y, height);
}
else if (isNormal) {
labelState.y = defaultLabelAttr.y;
}

if (layoutOption.align != null) {
labelState.style = labelState.style || {};
Expand Down

0 comments on commit 8126d2f

Please sign in to comment.