Label Background Color

336 views
Skip to first unread message

Bulent Ozhorasan

unread,
Jul 3, 2014, 9:04:26 AM7/3/14
to cesiu...@googlegroups.com
@CesiumTeam: Many thanks for this great product.
We're using LabelCollection.add(....) 
We can set font (property name font) and text color (property name fillColor)
But we are unable to find a property for setting background color of the label (color of the "small" rectangular region on which text is positioned)
Can you suggest a way to do that?
Thank you in advance.
Bulent Ozhorasan

Matthew Amato

unread,
Jul 3, 2014, 10:19:12 AM7/3/14
to cesiu...@googlegroups.com
We don't have support for a background color at this time.  It might be possible to add support but I would have to look at the code.  You can specify an outline color, which may fit your needs (assuming you weren't already aware of that options).


--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Scott Hunter

unread,
Jul 3, 2014, 10:39:22 AM7/3/14
to cesiu...@googlegroups.com
The problem with drawing a background color behind a label is that each letter in the label is actually a separate texture (and in fact duplicate letters share a single texure), and they aren't all the same size.  For example, here's what it looks like when each letter is drawn with a red background:

Inline image 2

This shows the actual dimensions of each letter.  

One possibility to get a rectangular background behind the entire label would be to measure the overall width and height, and draw an appropriately sized billboard at the same position, behind the label.  "Behind" from the camera's perspective can be done with the z coordinate of the billboard's eyeOffset.  The Label/LabelCollection code calculates the total width/height as part of its layout, but we don't currently expose any of that information.

Reply all
Reply to author
Forward
0 new messages