Skip to content

fix(widgets): Respect min/maxZoom#10033

Merged
felixpalmer merged 4 commits intomasterfrom
felix/widget-zoom-fix
Mar 3, 2026
Merged

fix(widgets): Respect min/maxZoom#10033
felixpalmer merged 4 commits intomasterfrom
felix/widget-zoom-fix

Conversation

@felixpalmer
Copy link
Copy Markdown
Collaborator

Closes #9679

Background

Widgets have no clean way to access the viewState and currently use the viewport in a number of places. This leads to the min/maxZoom props being dropped. As a result the ZoomWidget doesn't respect the limits, but also clicking the CompassWidget removes the min/maxZoom from the view state and after that even the normal interaction via the Controller is broken.

Change List

  • Add getViewState & setViewState helpers to Widget
  • Update widgets to use viewState rather than viewport when calculate nextViewState
  • Clamp zoom in ZoomWidget

Comment thread modules/widgets/src/geocoder-widget.tsx Outdated
// TODO - MOVE TO WIDGETIMPL?
setViewState(viewState: ViewState) {
flyTo(viewState: ViewState) {
const viewId = this.props.viewId || (viewState?.id as string) || 'default-view';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#10042 has a new pattern for when viewId isn't specified, and I think it'd make sense to do across the board. I see a few places we could add it in this PR

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisgervang I've done a pass to make it consistent, can you confirm you're happy?

@coveralls
Copy link
Copy Markdown

coveralls commented Mar 2, 2026

Coverage Status

coverage: 91.026% (-0.007%) from 91.033%
when pulling 4f2f22e on felix/widget-zoom-fix
into 32c5d8d on master.

Copy link
Copy Markdown
Collaborator

@chrisgervang chrisgervang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@felixpalmer felixpalmer merged commit 64af196 into master Mar 3, 2026
5 checks passed
@felixpalmer felixpalmer deleted the felix/widget-zoom-fix branch March 3, 2026 08:24
@chrisgervang chrisgervang added this to the v9.3 milestone Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] ZoomWidget ignores minZoom / maxZoom

3 participants