Skip to content

Commit

Permalink
Maintain camera heading, pitch, and roll on zoom CesiumGS#4639
Browse files Browse the repository at this point in the history
  • Loading branch information
wallw-teal committed Jun 23, 2017
1 parent 40147c0 commit 684f476
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Source/Scene/ScreenSpaceCameraController.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,14 @@ define([
var camera = scene.camera;
var mode = scene.mode;

var viewOptions = {
orientation: {
heading: camera.heading,
pitch: camera.pitch,
roll: camera.roll
}
};

if (camera.frustum instanceof OrthographicFrustum) {
if (Math.abs(distance) > 0.0) {
camera.zoomIn(distance);
Expand Down Expand Up @@ -647,6 +655,7 @@ define([
Cartesian3.cross(camera.direction, camera.up, camera.right);
Cartesian3.cross(camera.right, camera.direction, camera.up);

camera.setView(viewOptions);
return;
}

Expand Down Expand Up @@ -692,6 +701,8 @@ define([
} else {
camera.zoomIn(distance);
}

camera.setView(viewOptions);
}

var translate2DStart = new Ray();
Expand Down

0 comments on commit 684f476

Please sign in to comment.