fix(camera): preserve heading/pitch in moveCamera#79
Merged
Conversation
moveCamera rebuilt the camera from target+zoom only, dropping the current heading/bearing and tilt/pitch to 0. Build from the current camera instead across all three providers. fitCoordinates is unchanged: native bounds-fit APIs are north-up only. Closes #75
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
moveCamera(...)rebuilt the camera from target + zoom only, dropping the current heading/bearing and tilt/pitch to0. This fixes #75 by building from the current camera across all three providers:CameraPosition.Builder(map.cameraPosition)copy-constructor carries bearing + tilt, replacingnewLatLngZoom.cameraWithTarget:zoom:bearing:viewingAngle:, feedingbearing/viewingAnglefrom the current camera.duration > 0branch routed through north-upsetRegion:; it now drivesMKMapCamera. ExtractedcameraForCenterCoordinate:zoomLevel:inMKMapView+Zoomso the animated path and the existing setter share one altitude/heading source.fitCoordinates(...)is intentionally not changed: the native bounds-fit APIs (newLatLngBounds,fitBounds:withEdgeInsets:,setVisibleMapRect:) are north-up only, with no native way to fit rotated bounds. Docs updated to note this.Type of Change
Test Plan
Rotate the map to a non-zero heading, then trigger
moveCamera(...)(all duration modes) and confirm the heading/pitch is preserved on iOS (Apple + Google) and Android.Checklist