Skip to content

Commit

Permalink
Merge pull request #173 from gberaudo/use_pitch_and_not_removed_apis
Browse files Browse the repository at this point in the history
Use pitch and not removed apis
  • Loading branch information
gberaudo committed Feb 23, 2015
2 parents 12c7b03 + 995a175 commit 005adb8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
23 changes: 22 additions & 1 deletion Cesium.externs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
*/
var Cesium = {};

/**
* Prevent using a removed API.
* @constructor
*/
Cesium.RemovedAPI = function() {};


/**
* @constructor
* @param {number=} opt_r .
Expand Down Expand Up @@ -301,11 +308,18 @@ Cesium.Camera.prototype.heading;


/**
* @type {number}
* @type {!Cesium.RemovedAPI}
*/
Cesium.Camera.prototype.tilt;


/**
* @type {number}
* @const
*/
Cesium.Camera.prototype.pitch;


/**
* @param {!Cesium.Cartesian2} windowPosition
* @param {Cesium.Ray=} opt_result
Expand Down Expand Up @@ -475,6 +489,13 @@ Cesium.CameraEventAggregator.prototype.isDestroyed = function() {};
*/
Cesium.CameraEventAggregator.prototype.destroy = function() {};


/**
* @type{!Cesium.RemovedAPI}
*/
Cesium.Camera.prototype.setPositionCartographic;


/**
* @typedef {{
* position: (Cesium.Cartesian3|undefined),
Expand Down
10 changes: 4 additions & 6 deletions src/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,15 +324,13 @@ olcs.Camera.prototype.updateCamera_ = function() {
var height = this.scene_.globe.getHeight(carto);
carto.height = goog.isDef(height) ? height : 0;
}

this.cam_.setView({
positionCartographic: carto,
pitch: -Cesium.Math.PI_OVER_TWO,
heading: this.view_.getRotation()
pitch: this.tilt_ - Cesium.Math.PI_OVER_TWO,
heading: -this.view_.getRotation()
});

if (this.tilt_) {
this.cam_.lookUp(this.tilt_);
}
this.cam_.moveBackward(this.distance_);

this.checkCameraChange(true);
Expand Down Expand Up @@ -432,7 +430,7 @@ olcs.Camera.prototype.updateView = function() {
} else {
// fallback when there is no target
this.view_.setRotation(this.cam_.heading);
this.tilt_ = -this.cam_.tilt + Math.PI / 2;
this.tilt_ = -this.cam_.pitch + Math.PI / 2;
}

this.viewUpdateInProgress_ = false;
Expand Down

0 comments on commit 005adb8

Please sign in to comment.