fix: clustering with empty entity labels#13365
Open
pandeysambhi wants to merge 2 commits intoCesiumGS:mainfrom
Open
fix: clustering with empty entity labels#13365pandeysambhi wants to merge 2 commits intoCesiumGS:mainfrom
pandeysambhi wants to merge 2 commits intoCesiumGS:mainfrom
Conversation
Contributor
|
Thank you for the pull request, @pandeysambhi! Welcome to the Cesium community! In order for us to review your PR, please complete the following steps:
Review Pull Request Guidelines to make sure your PR gets accepted quickly. |
Author
|
Contributor
|
Thanks for submitting @pandeysambhi to kickoff work on this bug. I do see some flashing with this implementation as shown in this screen capture. I'm not immediately sure what is happening here but we should aim for a the smoother appearance like we see when label text is applied. Screencast.from.2026-04-07.16-18-14.mp4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Entities that use clustering (for example KML pins with billboards) and also define a label with empty
text(label: { text: '' }) stopped forming clusters: only the underlying primitives appeared.EntityClusterunions each billboard’s screen-space bounds with its companion label’s bounds fromLabel.getScreenSpaceBoundingBox. For empty text, with no background and no glyphs, that function previously leftx/yasInfinityand non-finite or negative width/height.BoundingRectangle.unionthen producedNaN, which broke the spatial index used for clustering.Change:
After computing width and height from glyphs or background, if any of
x,y,width, orheightis not finite, or ifwidthorheightis negative, the result is reset to a zero-size rectangle at the given screen-space position (center). That keeps clustering stable for “invisible” labels while preserving behavior for normal labels.Tests:
Regression coverage in
LabelCollectionSpec(empty text bounding box) andEntityClusterSpec(two billboards at the same position with empty labels, waiting on billboard collection readiness).Issue number and link
Fixes #13361 — Clustering no longer works when assigning a label to datasource entities
Testing plan
dataSource.entities.valuesloop settingentity.label = new Cesium.LabelGraphics({ text: '' })(or equivalent); clustering fails to show cluster labels / behaves as in the issue.npm run eslint -- packages/engine/Source/Scene/Label.js packages/engine/Specs/DataSources/EntityClusterSpec.js packages/engine/Specs/Scene/LabelCollectionSpec.jsnpm run test -- --includeName EntityClusternpm run test -- --includeName "empty text without background"Author checklist
CONTRIBUTORS.mdCHANGES.mdwith a short summary of my changeAI acknowledgment
If yes, I used the following Tools(s) and/or Service(s):
Cursor (AI-assisted editing and review)
If yes, I used the following Model(s):