-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Fix background updating when label hidden #12138 #12922
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
base: main
Are you sure you want to change the base?
Conversation
Thank you for the pull request, @Beilinson! ✅ We can confirm we have a CLA on file for you. |
There was a problem hiding this 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.
Oh, also - unit tests! We're definitely going to want some coverage of this edge case you're fixing. |
Description
There is a bug currently where updating certain label properties with
labelPrimitive.showBackground=true
andlabelPrimitive.show=false
will cause the background to disappear after settinglabelPrimitive.show=true
. The first sandcastle from the linked issue demonstrates this.Cause
Label backgrounds are removed from the
backgroundBillboardCollection
when eithershowBackground=false
,show=false
, orlabel.text.length === 0
. They are re-added properly, however their width and height is not updated becauserepositionAllGlyphs()
is called ahead of that.Solution
When hiding the label entirely, don't remove the
backgroundBillboard
, rather setbackgroundBillboard.show = false
. In order to prevent useless billboards, do remove ifshowBackground=false
is set explicitly.Issue number and link
#12138
Testing plan
Link to sandcastle 1
Author checklist
CONTRIBUTORS.md
CHANGES.md
with a short summary of my change