Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rectanglePromise.then is not a function #11392

Merged
merged 3 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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