Skip to content

feat: support camera commands on static maps#87

Merged
lodev09 merged 1 commit into
mainfrom
feat/static-camera-commands
Jul 8, 2026
Merged

feat: support camera commands on static maps#87
lodev09 merged 1 commit into
mainfrom
feat/static-camera-commands

Conversation

@lodev09

@lodev09 lodev09 commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Static maps previously ignored moveCamera and fitCoordinates (setEdgeInsets was already supported via #86). Ref methods now work in static mode like on a live map, minus animation (duration is ignored).

  • iOS: moveCamera and fitCoordinates update the static camera and re-render the base map. fitCoordinates fits the bounds into the viewport minus edge insets minus padding, with asymmetric padding shifting the visible center like edge insets. Zoom is derived per provider via a new zoomForMapPointsPerPoint: hook (Google: pixel-based web mercator; Apple: inverse of LuggStaticFittedMapRect's span-based fit).
  • iOS: the snapshot cache now keys on the provider's actual camera instead of the initial camera props, so command-driven re-renders don't poison initial-camera cache entries.
  • Android: static moveCamera/fitCoordinates go through the static camera-target shift (lite mode misrenders setPadding), updating the stored camera so later setEdgeInsets stays consistent. Mercator math is extracted into shared helpers.
  • Web: no changes needed - static mode keeps a live map with gestures disabled.

Type of Change

  • New feature

Test Plan

  • yarn tidy (typecheck, eslint, objclint, ktlint) passes
  • Exercise moveCamera and fitCoordinates on a static map in the example app on both platforms, including with edgeInsets set and with fit padding

Screenshots / Videos

N/A

Checklist

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

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

moveCamera and fitCoordinates now work in static mode. iOS re-renders
the base map at the final camera (fitCoordinates derives zoom via a
provider-specific inverse of the projection); Android re-centers
through the static camera-target shift since lite mode misrenders
padding. The iOS snapshot cache keys on the provider's actual camera so
command-driven re-renders don't poison initial-camera entries. duration
is ignored - static maps don't animate.
@lodev09 lodev09 merged commit dd5772e into main Jul 8, 2026
3 checks passed
@lodev09 lodev09 deleted the feat/static-camera-commands branch July 8, 2026 21:17
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