labels problem


Recently upgraded to Cesium 1.11 and I notice a change in the behaviour of my program.

Long story short, I want show a label next to an object when you pass the mouse over it and remove the label in other case.

Before the update my code worked, it’s possible that I changed something without notice and this be a stupid error unrelated with the new version.

I do this for transparent polygons mostly.

My question:

Why the code below show the label of some geometric figures and not the others?. The stripeMaterial, white outlined rectangle of the middle for example.

As example you can add the next code after the Geometry and Appearances sandcastle.

Thank you for your time and excuse my English.

var scene = viewer.scene;
var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);

var previousId;
var previousEntit;
function (movement) {

  var pickedObject = scene.pick(movement.endPosition);

  if (pickedObject === undefined || === undefined || === undefined){
    if (previousId !== undefined){
      viewer.entities.getById(previousId).label = undefined;
      previousId = undefined;
  else if( === previousId){

     var id =;
     //sanity output
  = new Cesium.LabelGraphics({text:id,
                              font : '20pt Lucida Console',
                              pixelOffset: new Cesium.Cartesian2(20,0),
                              style: Cesium.LabelStyle.FILL_AND_OUTLINE});
    if (previousId !== undefined){
        viewer.entities.getById(previousId).label = undefined;
     previousId = id;



Label requires that the entity has a valid “position” property; but not all geometry has such a property. You can fix this by setting a center point for the geometry when you construct the entity. This isn’t a change in behavior, it’s always been this way.