Skip to content

Conversation

Beilinson
Copy link

@Beilinson Beilinson commented Sep 25, 2025

Description

There is a bug currently where updating certain label properties with labelPrimitive.showBackground=true and labelPrimitive.show=false will cause the background to disappear after setting labelPrimitive.show=true. The first sandcastle from the linked issue demonstrates this.

Cause

Label backgrounds are removed from the backgroundBillboardCollection when either showBackground=false, show=false, or label.text.length === 0. They are re-added properly, however their width and height is not updated because repositionAllGlyphs() is called ahead of that.

Solution

When hiding the label entirely, don't remove the backgroundBillboard, rather set backgroundBillboard.show = false. In order to prevent useless billboards, do remove if showBackground=false is set explicitly.

Issue number and link

#12138

Testing plan

Link to sandcastle 1

Author checklist

  • I have submitted a Contributor License Agreement
  • I have added my name to CONTRIBUTORS.md
  • I have updated CHANGES.md with a short summary of my change
  • I have added or updated unit tests to ensure consistent code coverage
  • I have updated the inline documentation, and included code examples where relevant
  • I have performed a self-review of my code

Copy link

Thank you for the pull request, @Beilinson!

✅ We can confirm we have a CLA on file for you.

Copy link
Contributor

@mzschwartz5 mzschwartz5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start, thanks for identifying the issue and a fix for it!

I have a couple style comments and questions before we merge.

@mzschwartz5
Copy link
Contributor

Oh, also - unit tests! We're definitely going to want some coverage of this edge case you're fixing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants