Clean Text Labels with Cesium

This isn’t an app, but after spending longer than I would have liked on this, I wanted to share to hopefully help others!

Like many other folks on here, I wasn’t happy with how the canvas element was rendering the labels on my entities. Like other folks, my text labels appeared blurry and none of the suggested tricks were working for me.

After reading a little bit about the selectionIndicator and struggling how to actually implement my own new view model for it, I realized that I could simply update the HTML of the existing selector.

The result is that the green outline indicator is replaced with a box that includes the entities name. Because it uses the selection indicator, it follows my entity around the viewer (as opposed to the info box, which is statically positioned).

Screen Shot 2021-03-12 at 3.17.37 PM

The code for this, including the CSS, can be found at this Sandcastle.

Questions I still have

  • Is there a better way to replace the selection indicator? I’ve seen a lot of requests asking as much, but haven’t found an example of how to do it.
  • The selection indicator is always visible, even if the entity would otherwise be hidden behind the globe. In my case, this is okay, but I’m interested if there’s a way to change the visibility of the indicator based on the location of the entity?
1 Like