From e9e85f1c517a4539e0d24d35644475403054e95f Mon Sep 17 00:00:00 2001 From: William Wall Date: Fri, 23 Jun 2017 14:31:04 -0600 Subject: [PATCH 1/6] Maintain camera heading, pitch, and roll on zoom #4639 --- Source/Scene/ScreenSpaceCameraController.js | 15 +++++++++++++++ Specs/Scene/ScreenSpaceCameraControllerSpec.js | 12 ++++++++++++ 2 files changed, 27 insertions(+) diff --git a/Source/Scene/ScreenSpaceCameraController.js b/Source/Scene/ScreenSpaceCameraController.js index 59fd6f251463..7e0de7296f25 100644 --- a/Source/Scene/ScreenSpaceCameraController.js +++ b/Source/Scene/ScreenSpaceCameraController.js @@ -446,6 +446,13 @@ define([ var scratchCartesian = new Cartesian3(); var scratchCartesianTwo = new Cartesian3(); var scratchCartesianThree = new Cartesian3(); + var scratchZoomViewOptions = { + orientation: { + heading: 0, + pitch: 0, + roll: 0 + } + }; function handleZoom(object, startPosition, movement, zoomFactor, distanceMeasure, unitPositionDotDirection) { var percentage = 1.0; @@ -485,6 +492,11 @@ define([ var camera = scene.camera; var mode = scene.mode; + var orientation = scratchZoomViewOptions.orientation; + orientation.heading = camera.heading; + orientation.pitch = camera.pitch; + orientation.roll = camera.roll; + if (camera.frustum instanceof OrthographicFrustum) { if (Math.abs(distance) > 0.0) { camera.zoomIn(distance); @@ -646,6 +658,7 @@ define([ Cartesian3.cross(camera.direction, camera.up, camera.right); Cartesian3.cross(camera.right, camera.direction, camera.up); + camera.setView(scratchZoomViewOptions); return; } @@ -691,6 +704,8 @@ define([ } else { camera.zoomIn(distance); } + + camera.setView(scratchZoomViewOptions); } var translate2DStart = new Ray(); diff --git a/Specs/Scene/ScreenSpaceCameraControllerSpec.js b/Specs/Scene/ScreenSpaceCameraControllerSpec.js index 088d263eb09b..6b71846515ae 100644 --- a/Specs/Scene/ScreenSpaceCameraControllerSpec.js +++ b/Specs/Scene/ScreenSpaceCameraControllerSpec.js @@ -849,19 +849,31 @@ defineSuite([ it('zoom in 3D with wheel', function() { setUp3D(); var position = Cartesian3.clone(camera.position); + var heading = camera.heading; + var pitch = camera.pitch; + var roll = camera.roll; simulateMouseWheel(120); updateController(); expect(Cartesian3.magnitude(position)).toBeGreaterThan(Cartesian3.magnitude(camera.position)); + expect(camera.heading).toBeCloseTo(heading, 10); + expect(camera.pitch).toBeCloseTo(pitch, 10); + expect(camera.roll).toBeCloseTo(roll, 10); }); it('zoom out in 3D with wheel', function() { setUp3D(); var position = Cartesian3.clone(camera.position); + var heading = camera.heading; + var pitch = camera.pitch; + var roll = camera.roll; simulateMouseWheel(-120); updateController(); expect(Cartesian3.magnitude(position)).toBeLessThan(Cartesian3.magnitude(camera.position)); + expect(camera.heading).toBeCloseTo(heading, 10); + expect(camera.pitch).toBeCloseTo(pitch, 10); + expect(camera.roll).toBeCloseTo(roll, 10); }); it('zoom in 3D with orthographic projection', function() { From d24c5c18e0d7cb59197e9b84f3fbecc6a2afef02 Mon Sep 17 00:00:00 2001 From: William Wall Date: Tue, 11 Jul 2017 10:32:19 -0600 Subject: [PATCH 2/6] Add myself to contributors list --- CONTRIBUTORS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 089f762d9b52..c48292705fda 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -86,6 +86,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu * [Jason Crow](https://github.com/jason-crow) * [Flightradar24 AB](https://www.flightradar24.com) * [Aleksei Kalmykov](https://github.com/kalmykov) +* [BIT Systems](http://www.caci.com/bit-systems) + * [William Wall](https://github.com/wallw-bits) ## [Individual CLA](Documentation/Contributors/CLAs/individual-cla-agi-v1.0.txt) * [Victor Berchet](https://github.com/vicb) From df48ae93b26534f13cc931ce702fa8fe13b9386e Mon Sep 17 00:00:00 2001 From: William Wall Date: Tue, 11 Jul 2017 10:39:23 -0600 Subject: [PATCH 3/6] Updated CHANGES.md for #4639 and pull #5603 --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 47a3a45e686c..10acf20ee51b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -47,6 +47,7 @@ Change Log * Fixed a bug where Cesium would fail to load under Node.js and some webpack configurations. [#5593](https://github.com/AnalyticalGraphicsInc/cesium/issues/5593) * Fixed a bug where a Model's compressed textures were not being displayed. [#5596](https://github.com/AnalyticalGraphicsInc/cesium/pull/5596) * Fixed documentation for `OrthographicFrustum`. [#5586](https://github.com/AnalyticalGraphicsInc/cesium/issues/5586) +* Zoom about mouse now maintains camera heading, pitch, and roll [#4639](https://github.com/AnalyticalGraphicsInc/cesium/pull/5603) ### 1.35.1 - 2017-07-05 From 2c55e316a4a4ebc449290290ae25e67e03ea6dc1 Mon Sep 17 00:00:00 2001 From: William Wall Date: Thu, 13 Jul 2017 10:27:12 -0600 Subject: [PATCH 4/6] Use HeadingPitchRoll for view orientation options --- Source/Scene/ScreenSpaceCameraController.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Source/Scene/ScreenSpaceCameraController.js b/Source/Scene/ScreenSpaceCameraController.js index 7e0de7296f25..6a503930d742 100644 --- a/Source/Scene/ScreenSpaceCameraController.js +++ b/Source/Scene/ScreenSpaceCameraController.js @@ -8,6 +8,7 @@ define([ '../Core/destroyObject', '../Core/DeveloperError', '../Core/Ellipsoid', + '../Core/HeadingPitchRoll', '../Core/IntersectionTests', '../Core/isArray', '../Core/KeyboardEventModifier', @@ -35,6 +36,7 @@ define([ destroyObject, DeveloperError, Ellipsoid, + HeadingPitchRoll, IntersectionTests, isArray, KeyboardEventModifier, @@ -447,11 +449,7 @@ define([ var scratchCartesianTwo = new Cartesian3(); var scratchCartesianThree = new Cartesian3(); var scratchZoomViewOptions = { - orientation: { - heading: 0, - pitch: 0, - roll: 0 - } + orientation: new HeadingPitchRoll() }; function handleZoom(object, startPosition, movement, zoomFactor, distanceMeasure, unitPositionDotDirection) { From 4d17079eed115a45a65529399eef9bf6b1daa3b1 Mon Sep 17 00:00:00 2001 From: William Wall Date: Wed, 26 Jul 2017 11:08:36 -0600 Subject: [PATCH 5/6] Move change line to 1.37 section --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 10acf20ee51b..c783d502d217 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,7 @@ Change Log ### 1.37 - 2017-09-01 * Fixed `replaceState` bug that was causing the `CesiumViewer` demo application to crash in Safari and iOS +* Zoom about mouse now maintains camera heading, pitch, and roll [#4639](https://github.com/AnalyticalGraphicsInc/cesium/pull/5603) ### 1.36 - 2017-08-01 @@ -47,7 +48,6 @@ Change Log * Fixed a bug where Cesium would fail to load under Node.js and some webpack configurations. [#5593](https://github.com/AnalyticalGraphicsInc/cesium/issues/5593) * Fixed a bug where a Model's compressed textures were not being displayed. [#5596](https://github.com/AnalyticalGraphicsInc/cesium/pull/5596) * Fixed documentation for `OrthographicFrustum`. [#5586](https://github.com/AnalyticalGraphicsInc/cesium/issues/5586) -* Zoom about mouse now maintains camera heading, pitch, and roll [#4639](https://github.com/AnalyticalGraphicsInc/cesium/pull/5603) ### 1.35.1 - 2017-07-05 From 7d6d6af6ddb24c919ff97f1d422a3d088d397611 Mon Sep 17 00:00:00 2001 From: William Wall Date: Fri, 8 Sep 2017 10:22:04 -0600 Subject: [PATCH 6/6] Updated CHANGES.md --- CHANGES.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 12e829d1951d..7e5c73cd451f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ Change Log ========== +### 1.38 - 2017-10-02 + +* Zoom about mouse now maintains camera heading, pitch, and roll [#4639](https://github.com/AnalyticalGraphicsInc/cesium/pull/5603) + ### 1.37 - 2017-09-01 * Breaking changes @@ -24,7 +28,6 @@ Change Log * Fixed loading of binary glTFs containing CRN or KTX textures. [#5753](https://github.com/AnalyticalGraphicsInc/cesium/pull/5753) * Fixed specular computation for certain models using the `KHR_materials_common` extension. [#5773](https://github.com/AnalyticalGraphicsInc/cesium/pull/5773) * Fixed a picking bug in the `3D Tiles Interactivity` Sandcastle demo. [#5703](https://github.com/AnalyticalGraphicsInc/cesium/issues/5703) -* Zoom about mouse now maintains camera heading, pitch, and roll [#4639](https://github.com/AnalyticalGraphicsInc/cesium/pull/5603) ### 1.36 - 2017-08-01