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 attribution on layer visibility changes #9943

Merged
merged 2 commits into from
Aug 31, 2020

Conversation

mourner
Copy link
Member

@mourner mourner commented Aug 19, 2020

Closes #9824. Attribution is currently updated when the style changes (layers and sources added/removed, properties changed, etc.), but not updated when source visibility changes during zooming — either through going in or out of minzoom/maxzoom range, or through opacity change from zero to non-zero values or vice versa (e.g. through a zoom-based expression).

This PR introduces a new sourcedata event with sourceDataType: 'visibility', which the attribution control subsequently subscribes to for updating the attribution.

Launch Checklist

  • briefly describe the changes in this PR
  • write tests for all new functionality
  • document any changes to public APIs
  • manually test the debug page
  • 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>Fix a bug where attribution didn't update when layer visibility changed during zooming.</changelog>

@mourner mourner requested a review from a team August 19, 2020 14:08
@mourner mourner self-assigned this Aug 19, 2020
Copy link
Contributor

@sgolbabaei sgolbabaei left a comment

Choose a reason for hiding this comment

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

Thanks a lot for adding this change. This looks good to me. Are you going to add tests in another PR?

@mourner mourner marked this pull request as ready for review August 31, 2020 08:18
@mourner mourner merged commit 476ce36 into main Aug 31, 2020
@mourner mourner deleted the fix-visibility-attribution branch August 31, 2020 08:45
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.

AttributionControl misses updates
2 participants