-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Label backgrounds #4715
Label backgrounds #4715
Conversation
Conflicts: Source/Scene/LabelCollection.js
Conflicts: Source/Scene/LabelCollection.js
Somehow this has exposed a serious bug with removing a label that has both a label background and a height reference. Further investigation is needed.
Can you add a few examples to the Label Sandcastle example or add this to the above tasklist? |
For reference, here's the code I'm using to visually inspect the results of private function This code draws a pink DOM border around the reported position.
|
Will review again when this is fully ready unless there is something specific you want looked at now. |
It looks like the 1-pixel "shake" mentioned at the top of this review, in the Ground Clamping demo, is something that happens subtly to all billboards and glyphs when clamping is active, possibly due to small rounding errors. The sharp edge of the background billboard can make this much more noticeable than on other billboards, drawing attention to itself. But I think this is an unrelated existing issue with clamped billboards. |
I believe this is ready! |
Can you submit a separate issue now that this is more prominent? |
@emackey can you run all the tests in Chrome and Firefox? On Mac/Chrome, I have this new test failure:
|
@emackey did you test this with the various pixel and eye offset options? Do these need more unit tests? |
Just those comments. I'll be online for the next few hours to merge if this is ready. |
That vertical center test got bad numbers in it with my last update. Fixed. The unit tests don't currently test combinations of features, but I did test all the combinations with backgrounds I could think of with hand-edits to the above pasted Sandcastle demo. Generally these "just work" because the background itself is a billboard just like each glyph, and the various label offsets and options are merely copied down into the supporting billboards. The clustering options were tested later in the review and revealed a typo there, now fixed. All of the other options appear to be working correctly. This is ready. |
Awesome work, @emackey! |
@emackey if any, please close any related issues or reply to any related forum threads. |
@@ -35,6 +35,9 @@ define([ | |||
* @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the outline {@link Color}. | |||
* @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the outline width. | |||
* @param {Property} [options.show=true] A boolean Property specifying the visibility of the label. | |||
* @param {Property} [options.showBackground=true] A boolean Property specifying the visibility of the background behind the label. |
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.
Wrong default is specified here, FYI.
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.
Thanks!
This PR adds three options to
Label
primitives andLabelGraphics
for entities & CZML.showBackground
(default:false
)backgroundColor
(default:new Cesium.Color(0.165, 0.165, 0.165, 0.8)
, translucent dark gray)backgroundPadding
(default:new Cesium.Cartesian2(2, 2)
but this might be a bit small)Additionally, this PR adds a new value to
VerticalOrigin
calledBASELINE
, which for Billboards is just a synonym forBOTTOM
, but for labels will align the text along the baseline (for example with lowercasey
hanging down below the baseline). (Note that master's behavior is somewhat unpredictable now, depending on heights and descenders of glyphs, master'sBOTTOM
sometimes acts as a baseline and sometimes as a true bottom. For example try labeloy
vsOy
in master and look at the bottom alignment).I'm getting this open for review now, to get on the agenda for the code sprint, but it's not quite ready to merge yet. The main blocker is there appears to be a crash bug when terrain,HeightReference
, andshowBackground
are used together and then removed from the viewer. For an example of this, load the Ground Clamping sandcastle demo on this branch, and use the dropdown to switch to any other clamped entity choice. The point + label demo works, but trashes the frustum list when the entity is removed. This is tough to track down and any assistance would be appreciated.TODO
getScreenSpacePosition
to justify changes there.BASELINE
to various label/billboard demos.Separately:
czml-writer
-- Submitted Update schema for label backgrounds. AnalyticalGraphicsInc/czml-writer#123.