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

Update NavigationControl when min/maxZoom/Pitch change #11018

Merged
merged 3 commits into from Sep 24, 2021

Conversation

rreusser
Copy link
Contributor

See #11013

map.transform.minZoom and map.transform.maxZoom affect the appearance of NavigationControl, but map.setMinZoom() and map.setMaxZoom() do not currently notify the control when these values have changed. This PR emits a sequence of dummy events (zoomstart, zoom, zoomend) when the values are set so that the control is updated correctly.

The same goes for min/maxPitch.

Before (note that control does not update to mach minZoom until the map is zoomed):
pre-fix

After (control updates immediately when values are set):
post-fix

Launch Checklist

  • briefly describe the changes in this PR
  • include before/after visuals or gifs if this PR includes visual changes
  • write tests for all new functionality
  • document any changes to public APIs
  • post benchmark scores
  • manually test the debug page
  • tagged @mapbox/map-design-team @mapbox/static-apis if this PR includes style spec API or visual changes
  • tagged @mapbox/gl-native if this PR includes shader changes or needs a native port
  • apply changelog label ('bug', 'feature', 'docs', etc) or use the label 'skip changelog'
  • add an entry inside this element for inclusion in the mapbox-gl-js changelog: <changelog>Update NavigationControl when min and max zoom are changed</changelog>

@@ -532,7 +532,7 @@ test(`Map#on mousedown can have default behavior prevented and still fire subseq
map.on('click', click);

simulate.click(map.getCanvas());
t.ok(click.callCount, 1);
t.equal(click.callCount, 1);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A drive-by fix for what appears to be a simple error.

@avpeery avpeery self-requested a review September 20, 2021 21:20
Copy link
Contributor

@avpeery avpeery left a comment

Choose a reason for hiding this comment

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

Nice fix Ricky! LGTM and great unit tests. I don't think this needs a debug page since it seems setMinZoom, etc are already being implemented in different debug pages, but is something to consider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants