Skip to content

Commit

Permalink
Merge pull request #11392 from hongfaqiu/main
Browse files Browse the repository at this point in the history
fix: rectanglePromise.then is not a function
  • Loading branch information
ggetz authored Jul 5, 2023
2 parents 2412404 + d3d717a commit ddfc7eb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion packages/widgets/Source/Viewer/Viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
15 changes: 15 additions & 0 deletions packages/widgets/Specs/Viewer/ViewerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ describe(
return new Rectangle();
},
},
rectangle: Rectangle.MAX_VALUE,
};

const testProviderViewModel = new ProviderViewModel({
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit ddfc7eb

Please sign in to comment.