In 2d mode, if zoomed far enough out to see duplicate locations (e.g. Japan on both the left and right sides of the screen), the results returned from wgs84towindowcoordinates inappropriately jump to the other side.
Is this is a bug or expected behavior? If the later, is there a workaround?
Sandcastle code replicating the issue. Notice how the x coord returned as the mouse is hovered over Japan on the left side of the screen is what it should be if hovering over the right side of the screen.
var viewer = new Cesium.Viewer(‘cesiumContainer’, {
selectionIndicator : false,
infoBox : false,
sceneMode: Cesium.SceneMode.SCENE2D
});
var scene = viewer.scene;
var handler;
viewer.camera.setView({
destination : Cesium.Cartesian3.fromDegrees(-40, 0, 42000000.0)
});
Sandcastle.addDefaultToolbarButton(‘Show Cartographic Position on Mouse Over’, function() {
var entity = viewer.entities.add({
label : {
show : false
}
});
// Mouse over the globe to see the cartographic position
handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function(movement) {
var cartesian = viewer.camera.pickEllipsoid(movement.endPosition, scene.globe.ellipsoid);
if (cartesian) {
var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
var pixelLocation = Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, cartesian, new Cesium.Cartesian2());
entity.position = cartesian;
entity.label.show = true;
entity.label.text = '(' + Math.round(pixelLocation.x) + ',' + Math.round(pixelLocation.y) + ')';
} else {
entity.label.show = false;
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
});
Sandcastle.reset = function() {
viewer.entities.removeAll();
handler = handler && handler.destroy();
};
``