camera.computeViewRectangle is returning a wrong extent when extent crosses the IDL.

When the extent crosses the IDL the rectangle.west is returning as negative when it is supposed to be positive. The east is returning positive when it is supposed to be negative.

Use the following code in Sandcastle to see the issue. Go to the Pacific area near the IDL (keep IDL at center of view) and zoom in to an altitude where the sky is not visible. The label will show the current mouse coordinate and current west and east value of the extent. I’m also attaching a snapshot.

var viewer = new Cesium.Viewer(‘cesiumContainer’, {
selectionIndicator : false,
infoBox : false

var scene = viewer.scene;
var handler;

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 =, scene.globe.ellipsoid);
    var extent =;
    if (cartesian) {
        var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
        var longitudeString = Cesium.Math.toDegrees(cartographic.longitude).toFixed(2);
        var latitudeString = Cesium.Math.toDegrees(cartographic.latitude).toFixed(2);

        entity.position = cartesian; = true;
        entity.label.text = '(' + longitudeString + ', ' + latitudeString + ')  extent: ' + 'west =' + extent.west.toFixed(2) + ' east = ' + extent.east.toFixed(2);
    } else { = false;
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);


Sandcastle.reset = function() {
handler = handler && handler.destroy();



Thanks for the code example Alberto!
I’ve filed an issue on GitHub to fix the bug:

It looks like we forgot to switch the west and east values for rectangles that cross the IDL

Thanks again,