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

Add setVerticalFieldOfView() to public API #4914

Merged
merged 11 commits into from
Oct 31, 2024
Merged

Conversation

NathanMOlson
Copy link
Contributor

@NathanMOlson NathanMOlson commented Oct 28, 2024

Launch Checklist

This PR adds setVerticalFieldOfView() to the public API. This allows different camera focal length to be used, like this:

set_fov.mp4

This is useful for applications that control the camera position: #4717

  • 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.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality.
  • Document any changes to public APIs.
  • Add an entry to CHANGELOG.md under the ## main section.

@NathanMOlson NathanMOlson marked this pull request as draft October 28, 2024 21:51
@NathanMOlson
Copy link
Contributor Author

@wipfli I think you were asking about this at the last MapLibre-GL-JS meeting?

src/ui/camera.ts Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Oct 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.66%. Comparing base (09758d9) to head (a6ef17e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4914      +/-   ##
==========================================
+ Coverage   90.49%   90.66%   +0.17%     
==========================================
  Files         265      265              
  Lines       38103    38113      +10     
  Branches     3181     3150      -31     
==========================================
+ Hits        34482    34557      +75     
+ Misses       2674     2599      -75     
- Partials      947      957      +10     

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

@HarelM
Copy link
Collaborator

HarelM commented Oct 28, 2024

I'm not sure how comfortable I am with exposing this. Can we gather more feedback on this?
Found this article from a few years back, which is somewhat similar to what is requested here I guess...
https://mikevanriel.com/2019/01/04/setting-the-field-of-view-fov-in-mapbox-gl-js/

@HarelM
Copy link
Collaborator

HarelM commented Oct 28, 2024

@louwers can this be changed in the Android or native code? I've seen some mapbox old docs that reference this I think.

@louwers
Copy link
Collaborator

louwers commented Oct 28, 2024

@HarelM MapLibre Native has a hardcoded fov.

@NathanMOlson NathanMOlson marked this pull request as ready for review October 28, 2024 23:25
@NathanMOlson NathanMOlson changed the title Add setFOV to public API Add setVerticalFieldOfView() to public API Oct 28, 2024
@wipfli
Copy link
Contributor

wipfli commented Oct 29, 2024

Thanks for sharing! Does this work as well for terrain3d and globe?

@NathanMOlson
Copy link
Contributor Author

Thanks for sharing! Does this work as well for terrain3d and globe?

Yes.

Copy link
Collaborator

@HarelM HarelM left a comment

Choose a reason for hiding this comment

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

I hope this won't bite is in the future...

@HarelM HarelM enabled auto-merge (squash) October 31, 2024 05:56
@HarelM HarelM merged commit d3f2bca into maplibre:main Oct 31, 2024
15 checks passed
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.

5 participants