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’;
}
``