Sandcastle Labels example, suggested update

In the interest of improving documentation, while I experimented in the Labels example, I realized there’s an extra line of code in this function below.
It’s redundantly setting a position for the billboard that’s identical to the position of it’s parent entity. If you don’t delete the unnecessary line of code, perhaps add a comment explaining that it’s only necessary if DIFFERENT than the parent entity, right?

Best regards-

-Jon

function offsetByDistance() {

Sandcastle.declare(offsetByDistance);

var image = new Image();

image.onload = function() {

viewer.entities.add({

position : Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222),

billboard : {

//position : Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222),

//position is inherited from parent entity,

//position is not necessary UNLESS specifying a DIFFERENT position than parent entity

//this could mislead someone getting started…

//scaleByDistance : new Cesium.NearFarScalar(1.5e2, 5.0, 1.5e7, 0.5),

image : image

},

label : {

text : ‘Label on top of scaling billboard’,

font : ‘20px sans-serif’,

showBackground : false,

horizontalOrigin : Cesium.HorizontalOrigin.CENTER,

pixelOffset : new Cesium.Cartesian2(0.0, -(image.height+(0.5*20))),

eyeOffset: new Cesium.Cartesian3(0,0,-1),

//pixelOffsetScaleByDistance : new Cesium.NearFarScalar(1.5e2, 3.0, 1.5e7, 0.5)

}

});

};

image.src = ‘…/images/facility.gif’;

}

``

Thanks for pointing that out, Jon! Deleting billboard.position seems like the right thing to do here.
Would you be interested in opening a pull request with the fix? You can find instructions for doing this in our Contributing documentation here: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/CONTRIBUTING.md#opening-a-pull-request

Best,

Hannah

You’re correct that the billboard position is unnecessary, likely a result of a copy/paste error in the example. To clarify your explanation, however: the billboard object literal here (which ends up being merged into a BillboardGraphics object, whose available properties are documented) simply does not have a position property at all. In the example, it is entirely ignored. There is no notion that a billboard’s position can be somehow different than the position of the containing entity.