Skip to content

fix(camera): preserve heading/pitch in moveCamera#79

Merged
lodev09 merged 1 commit into
mainfrom
fix/move-camera-preserve-heading
May 27, 2026
Merged

fix(camera): preserve heading/pitch in moveCamera#79
lodev09 merged 1 commit into
mainfrom
fix/move-camera-preserve-heading

Conversation

@lodev09
Copy link
Copy Markdown
Collaborator

@lodev09 lodev09 commented May 27, 2026

Summary

moveCamera(...) rebuilt the camera from target + zoom only, dropping the current heading/bearing and tilt/pitch to 0. This fixes #75 by building from the current camera across all three providers:

  • Android (Google)CameraPosition.Builder(map.cameraPosition) copy-constructor carries bearing + tilt, replacing newLatLngZoom.
  • iOS (Google)cameraWithTarget:zoom:bearing:viewingAngle:, feeding bearing/viewingAngle from the current camera.
  • iOS (Apple) — the duration > 0 branch routed through north-up setRegion:; it now drives MKMapCamera. Extracted cameraForCenterCoordinate:zoomLevel: in MKMapView+Zoom so 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

  • Bug fix

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

  • I tested on iOS
  • I tested on Android
  • I tested on Web
  • I updated the documentation (if needed)

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
@lodev09 lodev09 merged commit 59ba471 into main May 27, 2026
3 checks passed
@lodev09 lodev09 deleted the fix/move-camera-preserve-heading branch May 27, 2026 20:53
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.

fitCoordinates(...) resets heading/bearing to 0; moveCamera(...) also does not preserve heading/bearing

1 participant