Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove empty labels from being candidates for overlap checking #19982

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/label/labelLayoutHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,14 @@
const transform = labelItem.transform;
const label = labelItem.label;
const labelLine = labelItem.labelLine;

// if the label has no text, remove it as a candidate for overlap checking
if (label.style?.text === ""){

Check failure on line 320 in src/label/labelLayoutHelper.ts

View workflow job for this annotation

GitHub Actions / lint (18.x)

Strings must use singlequote

Check failure on line 320 in src/label/labelLayoutHelper.ts

View workflow job for this annotation

GitHub Actions / lint (18.x)

Missing space before opening brace
hideEl(label);
labelLine && hideEl(labelLine);
continue;
}

Check failure on line 325 in src/label/labelLayoutHelper.ts

View workflow job for this annotation

GitHub Actions / lint (18.x)

Trailing spaces not allowed
globalRect.copy(labelItem.rect);
// Add a threshold because layout may be aligned precisely.
globalRect.width -= 0.1;
Expand Down Expand Up @@ -362,4 +370,4 @@
displayedLabels.push(labelItem);
}
}
}
}
Loading