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

Fix a bug in which map.setStyle() could not be used to enable terrain. #10177

Merged
merged 3 commits into from
Dec 10, 2020

Conversation

arindam1993
Copy link
Contributor

@arindam1993 arindam1993 commented Dec 10, 2020

We weren't handling the usage of the setTerrain command in style diffing correctly.Theres a cyclic dependency between terrain and source. This is analogous to layers.

This change ensures that we remove the terrain if the source is being removed, and then in a 2nd pass add it back in with a modified source if necessary.

Launch Checklist

  • briefly describe the changes in this PR
  • write tests for all new functionality
  • 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 in which map.setStyle() could not be used to enable terrain.</changelog>

@@ -1412,7 +1412,6 @@ class Map extends Camera {
try {
if (this.style.setState(style)) {
this._update(true);
this._updateTerrain();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing this is fine because _update calls setTerrain since it performs a style diff internally.

@arindam1993 arindam1993 changed the title Ensure terrain can be enabled via setStyle style diffing Fix a bug in which map.setStyle() could not be used to enable terrain. Dec 10, 2020
Copy link
Contributor

@ansis ansis 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 to me!

Copy link
Contributor

@karimnaaji karimnaaji left a comment

Choose a reason for hiding this comment

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

🟢

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.

3 participants