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
Refactor zoom for Cesium and Leaflet maps. #6815
base: main
Are you sure you want to change the base?
Conversation
item.rectangle.east - item.rectangle.west >= 360 | ||
) { | ||
zoomToView = this.props.viewState.terria.mainViewer.homeCamera; | ||
console.log("Extent is wider than world so using homeCamera."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idealZoom
behaviour has been folded into the rest of the zoom code path.
await this.currentViewer.zoomTo(firstMappableItem, 0.0); | ||
await this.currentViewer.zoomTo(mappables, 0.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of zooming to first mappable in the workbench, we zoom to a view showing all the mappables.
This PR also fixes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! This is so much cleaner than before. I just have two small comments
I tested with a bunch of catalog items and could only find one issue with this:
Improved zooming to clamped DataSource entities:
here is a before and after example. See how when zooming to the Ducky, in the before example it is nowhere to be seen.
This works for me in "3d terrain" mode, but in "3d smooth" mode I still get put under the globe. This may be out-of-scope for this PR, if so let me know and I can make a ticket
@@ -842,124 +836,7 @@ export default class Cesium extends GlobeOrMap { | |||
} | |||
|
|||
doZoomTo(target: any, flightDurationSeconds = 3.0): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please type target
here.
Also, can you please use ZoomTarget
here
terriajs/lib/Models/NoViewer.ts
Lines 28 to 31 in bdb0b60
doZoomTo( | |
v: CameraView | Rectangle | MappableMixin.Instance, | |
t: any | |
): Promise<void> { |
* TODO: Can we can simplify by reducing everything to just CameraView? | ||
*/ | ||
export type ZoomView3d = BoundingSphere | Cartesian3 | CameraView; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think keeping ZoomView3d
flexible will might help us in the long run - as then it will be easier to implement zoom behaviour for new catalog items/mappable items.
But there is a trade off in therms of maintenance costs. What do you think?
What this PR does
Fixes #6761
Changes:
Map/Leaflet/Picking.ts
andMap/Cesium/Picking.ts
.terriajs/lib/Map/Cesium/compute3dZoomView.ts
Lines 239 to 250 in 0ba6212
This replicates a similar change to the Cesium Viewer. And here is a before and after example. See how when zooming to the Ducky, in the before example it is nowhere to be seen.
MappableMixin.Instance
types.Test me
Checklist
doc/
.