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 unwanted roll #5083 #5092

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Conversation

NathanMOlson
Copy link
Contributor

@NathanMOlson NathanMOlson commented Nov 21, 2024

Launch Checklist

Fix #5083.

Use spherical linear interpolation only when rollEnabled is true. Otherwise, use linear interpolation of Euler angles.

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Write tests for all new functionality.
  • Add an entry to CHANGELOG.md under the ## main section.

@NathanMOlson NathanMOlson marked this pull request as draft November 21, 2024 18:09
src/ui/camera.test.ts Outdated Show resolved Hide resolved
Copy link

codecov bot commented Nov 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.95%. Comparing base (94e2729) to head (ad15a1d).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5092      +/-   ##
==========================================
- Coverage   89.06%   88.95%   -0.11%     
==========================================
  Files         269      269              
  Lines       38386    38410      +24     
  Branches     2370     2426      +56     
==========================================
- Hits        34189    34169      -20     
- Misses       3188     3210      +22     
- Partials     1009     1031      +22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@NathanMOlson NathanMOlson changed the title add failing unit test to demonstrate #5083 Fix unwanted roll #5083 Nov 21, 2024
src/ui/camera.ts Outdated
@@ -746,6 +746,10 @@ export abstract class Camera extends Evented {
return this;
}

setRollEnabled(rollEnabled: boolean) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This world become part of the public API, is this intended?
Do we have similar API methods like this?
What about symmetry of getRollEnabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it is not intended that this become part of the public API. Is there a way to prevent that? Is adding @internal sufficient?

Copy link
Collaborator

Choose a reason for hiding this comment

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

peotected should probably do it, and in terms of docs internal should do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I've made setRollEnabled() protected and @internal. Do you still want a getRollEnabled() even though there is currently no use for one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

protected prevents the tests from running, so I'm going to have to do something else.

@@ -643,6 +643,7 @@ export class Map extends Camera {
this._trackResize = resolvedOptions.trackResize === true;
this._bearingSnap = resolvedOptions.bearingSnap;
this._centerClampedToGround = resolvedOptions.centerClampedToGround;
this.cameraHelper.setRollEnabled(resolvedOptions.rollEnabled === true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can someone set roll value while roll is disabled? How does these two interact?

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.

Map ends up with roll when rollEnabled=false
2 participants