You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Go to the method function updateDistanceLegendCesium(viewModel, scene) and add this code:
function updateDistanceLegendCesium(viewModel, scene) {
var now = getTimestamp();
if (now < viewModel._lastLegendUpdate + 250) {
return
}
viewModel._lastLegendUpdate = now;
var width = scene.canvas.clientWidth;
var height = scene.canvas.clientHeight;
// I've changed from here ...
var p1 = new Cartesian2(width / 2 | 0, height - 1);
var p2 = new Cartesian2(1 + width / 2 | 0, height - 1);
// try to get from a 3D map.
var left = scene.camera.getPickRay( p1 );
var right = scene.camera.getPickRay( p2 );
var globe = scene.globe;
var leftPosition = globe.pick(left, scene);
var rightPosition = globe.pick(right, scene);
if (!defined(leftPosition) || !defined(rightPosition)) {
// It is a 2D map. globe.pick won't work
leftPosition = scene.camera.pickEllipsoid(p1, scene.globe.ellipsoid);
rightPosition = scene.camera.pickEllipsoid(p2, scene.globe.ellipsoid);
}
// ... to here
if (!defined(leftPosition) || !defined(rightPosition)) {
viewModel.barWidth = undefined;
viewModel.distanceLabel = undefined;
return
}
When I change my map to Cesium.SceneMode.SCENE2D the scale bar vanishes....
What is wrong?
The text was updated successfully, but these errors were encountered: