Skip to content

Conversation

@Auspicus
Copy link

@Auspicus Auspicus commented Nov 27, 2025

Adds _getTransformForUpdate calls to setMinZoom and setMaxZoom to allow transformCameraUpdate to apply changes to zoom and prevent stale transform copies from being reapplied.

From a correctness perspective, this probably makes more sense as a change to the transform (specifically zoom here) should be run through the transformCameraUpdate function to allow the user to apply their own changes to the transform. It serendipitously also fixes the bug with the transform copies being re-applied, although I'm not sure exactly why they were being re-applied in the first place.

_getTransformForUpdate is not called within map.ts so might be better suited to camera.ts.

Fixes #6766

todo:

  • add test which checks that transformCameraUpdate is called after setXZoom calls
  • add entry to CHANGELOG.md
  • add test for transform copy being re-applied?

Launch Checklist

  • 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.
  • Post benchmark scores.
  • Add an entry to CHANGELOG.md under the ## main section.

@codecov
Copy link

codecov bot commented Nov 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.25%. Comparing base (29d1c0e) to head (7799892).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6781   +/-   ##
=======================================
  Coverage   92.25%   92.25%           
=======================================
  Files         285      285           
  Lines       23754    23758    +4     
  Branches     5051     5051           
=======================================
+ Hits        21915    21919    +4     
  Misses       1839     1839           

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Auspicus Auspicus force-pushed the fix/transform-camera-update-zoom branch from 3d73ebb to 11ed0a8 Compare November 27, 2025 12:52
@Auspicus Auspicus force-pushed the fix/transform-camera-update-zoom branch from 11ed0a8 to 7799892 Compare November 27, 2025 12:56
@HarelM
Copy link
Collaborator

HarelM commented Nov 29, 2025

To be honest I'm not sure what's the point of map inheriting from camera as it is the only class the inherits from camera, they probably need to be united into a single class, but that's a bit besides the point here.
Can you add a test to cover the bug that this is fixing?
Also, any chance you could look for other public API related to map and transform that might need this fix as well?

@HarelM
Copy link
Collaborator

HarelM commented Nov 29, 2025

Thanks for taking the time to open this PR and fix this issue!

@HarelM
Copy link
Collaborator

HarelM commented Dec 4, 2025

Hi, any updates regarding the tests and changelog entry?

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.

Changes to transform via setMinZoom or setMaxZoom can be superseded by stale transform copy when using transformCameraUpdate

2 participants