Skip to content

fix(ios): frame camera commands against the final edge insets - #102

Merged
lodev09 merged 1 commit into
mainfrom
fix/ios-fit-final-insets
Oct 18, 2026
Merged

lodev09 merged 1 commit into
mainfrom
fix/ios-fit-final-insets

Conversation

@lodev09

@lodev09 lodev09 commented Oct 18, 2026

Copy link
Copy Markdown
Member

Summary

On iOS, a moveCamera or fitCoordinates sent while an animated setEdgeInsets is still running frames against the wrong insets. Callers that animate the insets with a sheet and then refit have to wait out the animation (300 ms by default) before fitting.

  • Google: the inset animation moves _mapView.padding frame by frame. fitBounds resolves against the padding at the moment it's called, so it uses the in-between value.
  • Apple: each frame of the inset animation re-centers the map with setCenterCoordinate:animated:NO, which cancels a running camera animation. The fit stops on the first frame, and the map only shifts with the insets.

The fix:

  • Google: fitCoordinates computes the camera with cameraForBounds:insets: with the padding set to the target insets for the call. The padding animation keeps running, and the camera target stays centered in the padding while it does. moveCamera already used a camera target, so it's unchanged.
  • Apple: moveCamera and fitCoordinates first finish a running inset animation by setting the final layoutMargins without the re-center. The camera command moves the map anyway.

Android already applies the final padding before a camera update (see #101).

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Test Plan

Bare example on the iOS 27 simulator (iPhone 18 Pro Max). "Fit Markers" and "Move Camera" were temporarily changed to call setEdgeInsets (bottom +300, default animation) right before the camera command. A second plain "Fit Markers" gives the correct frame. The status line gives the camera center and zoom.

Provider Case 1.1.5 This branch
Google Fit during the inset animation 37.78423, -122.42650 (z13.9). The plain fit moves to (z13.4). 37.78456, -122.42650 (z13.4). The plain fit doesn't move the camera.
Apple Fit during the inset animation 37.78000, -122.43000 (z13.9): the center doesn't move and a marker ends at the top edge. The plain fit moves to 37.78456, -122.42650 (z13.4). 37.78456, -122.42650 (z13.4). The plain fit doesn't move the camera.
Google Move during the inset animation not run Centered on the marker: 37.77500, -122.44300
Apple Move during the inset animation not run Centered on the marker: 37.77500, -122.44300

Screenshots / Videos

Checklist

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

@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lugg-maps Ready Ready Preview Oct 18, 2026 5:51pm UTC

Request Review

@lodev09
lodev09 merged commit 6c47f3c into main Oct 18, 2026
5 checks passed
@lodev09
lodev09 deleted the fix/ios-fit-final-insets branch October 18, 2026 18:13

This branch was successfully deployed

1 active deployment
Preview — e177d92c Deployed Oct 18, 2026 by vercel[bot]
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.

1 participant