From a03806f5718da85350f6fe5c517ebe3947a72a80 Mon Sep 17 00:00:00 2001 From: hongfaqiu <951142905@qq.com> Date: Wed, 5 Jul 2023 21:37:55 +0800 Subject: [PATCH 1/3] fix: rectanglePromise.then is not a function --- CHANGES.md | 1 + CONTRIBUTORS.md | 1 + packages/widgets/Source/Viewer/Viewer.js | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 8cd411ae6e8b..5d82a29ebbf8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -95,6 +95,7 @@ try { - Fixed debug label rendering in `Cesium3dTilesInspector`. [#11355](https://github.com/CesiumGS/cesium/issues/11355) - Fixed credits for imagery layer shows up even when layer is hidden. [#11340](https://github.com/CesiumGS/cesium/issues/11340) - Fixed Insufficient buffer size thrown by rendering 3dtiles. [#11358](https://github.com/CesiumGS/cesium/pull/11358) +- Fixed the error report "rectanglePromise.then is not a function" that occurred when using ``viewer.flyTo`` to navigate to an ImageryLayer. [#11392](https://github.com/CesiumGS/cesium/pull/11392) ##### Deprecated :hourglass_flowing_sand: diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 099c5a376a2b..934da94f7593 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -361,3 +361,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu - [IKangXu](https://github.com/IKangXu) - [e3dio](https://github.com/e3dio) - [Dphalos](https://github.com/Dphalos) +- [hongfaqiu](https://github.com/hongfaqiu) diff --git a/packages/widgets/Source/Viewer/Viewer.js b/packages/widgets/Source/Viewer/Viewer.js index ede33750d293..114350c8f13e 100644 --- a/packages/widgets/Source/Viewer/Viewer.js +++ b/packages/widgets/Source/Viewer/Viewer.js @@ -2137,7 +2137,7 @@ function zoomToOrFly(that, zoomTarget, options, isFlight) { let rectanglePromise; if (defined(zoomTarget.imageryProvider)) { - rectanglePromise = zoomTarget.getImageryRectangle(); + rectanglePromise = Promise.resolve(zoomTarget.getImageryRectangle()); } else { rectanglePromise = new Promise((resolve) => { const removeListener = zoomTarget.readyEvent.addEventListener(() => { From 8fadd6d83bf6c4d42f0d93b57ddabd652d5ffadf Mon Sep 17 00:00:00 2001 From: Gabby Getz Date: Wed, 5 Jul 2023 16:47:06 -0400 Subject: [PATCH 2/3] Move update to the next release --- CHANGES.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 5d82a29ebbf8..6b59e4e78995 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,13 @@ # Change Log +### 1.108 - 2023-08-01 + +#### @cesium/widgets + +##### Fixes :wrench: + +- Fixed the error report "rectanglePromise.then is not a function" that occurred when using `viewer.flyTo` to navigate to an ImageryLayer. [#11392](https://github.com/CesiumGS/cesium/pull/11392) + ### 1.107 - 2023-07-03 #### Major Announcements :loudspeaker: @@ -95,7 +103,6 @@ try { - Fixed debug label rendering in `Cesium3dTilesInspector`. [#11355](https://github.com/CesiumGS/cesium/issues/11355) - Fixed credits for imagery layer shows up even when layer is hidden. [#11340](https://github.com/CesiumGS/cesium/issues/11340) - Fixed Insufficient buffer size thrown by rendering 3dtiles. [#11358](https://github.com/CesiumGS/cesium/pull/11358) -- Fixed the error report "rectanglePromise.then is not a function" that occurred when using ``viewer.flyTo`` to navigate to an ImageryLayer. [#11392](https://github.com/CesiumGS/cesium/pull/11392) ##### Deprecated :hourglass_flowing_sand: From d3d717a2d1f55bfac7edb6f4fca51d7fc97cf2d3 Mon Sep 17 00:00:00 2001 From: Gabby Getz Date: Wed, 5 Jul 2023 17:17:32 -0400 Subject: [PATCH 3/3] add unit test --- packages/widgets/Specs/Viewer/ViewerSpec.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/widgets/Specs/Viewer/ViewerSpec.js b/packages/widgets/Specs/Viewer/ViewerSpec.js index 704e20e7f26c..14b3037a4170 100644 --- a/packages/widgets/Specs/Viewer/ViewerSpec.js +++ b/packages/widgets/Specs/Viewer/ViewerSpec.js @@ -62,6 +62,7 @@ describe( return new Rectangle(); }, }, + rectangle: Rectangle.MAX_VALUE, }; const testProviderViewModel = new ProviderViewModel({ @@ -1869,6 +1870,20 @@ describe( }); }); + it("flyTo flies to imagery layer with default offset when options are not defined", async function () { + viewer = createViewer(container); + + const imageryLayer = new ImageryLayer(testProvider); + + const promise = viewer.flyTo(imageryLayer, { + duration: 0, + }); + + viewer._postRender(); + + await expectAsync(promise).toBeResolved(); + }); + it("flyTo flies to VoxelPrimitive with default offset when options not defined", function () { viewer = createViewer(container);