-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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(widgets): ZoomWidget: Prevent crash when used with OrthographicView #9459
Conversation
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 fly-to algo has ties to mercator polar math (e.g. non-linear zoom, great circle pathing) and could be a nice effect in cartesian views.
LinearInterpolator works with all views.
A nice easing should be relatively simple to add in interpolator, but we currently don't ship one. It'd been left to the user to write one themselves.. we provide the extendable interface, but haven't felt compelled to maintain an easing library in the core.
I'd say, if fly-to isn't easy to patch for non-geo then we have a compelling reason to add simple eased interpolator compatible with all views (or add a easing
prop to the linear one.. something like that).
Transitions without easing or interpolation are rough..
@@ -117,14 +117,15 @@ export class ZoomWidget implements Widget<ZoomWidgetProps> { | |||
|
|||
handleZoom(viewport: Viewport, nextZoom: number) { | |||
const viewId = this.viewId || viewport?.id || 'default-view'; | |||
const nextViewState = { | |||
const nextViewState: Record<string, unknown> = { |
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 thought we had a generic view state type to use for this
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 thought we had a generic view state type to use for this
I couldn't figure it out. It is a complex thing to type, it is heavily overloaded and was designed before we introduced types.
Sounds reasonable! As hubble creator, you are best positioned to determine what the right approach here. For now I changed the PR to switch to LinearInterpolator if non-geo, and allow interpolator to be disabled by setting transtionDuration to 0. That should unblock me. |
Closes #
Background
Change List
latitude
is not present in view state.