feat: Auto-fit map to all pins & show user's current location#104
feat: Auto-fit map to all pins & show user's current location#104devin-ai-integration[bot] wants to merge 1 commit into
Conversation
- Replace bare showAnnotations with manual region computation that handles edge cases (single pin, tight clusters, wide spreads) and applies 30pt edge insets so pins aren't clipped by rounded corners. - Defer the fit to the next run-loop pass so the map has valid frame geometry from activated constraints before computing the region. - Enable showsUserLocation to display the blue dot on the map. - On iOS, re-fit the map once user location becomes available so the viewport includes both all pins and the user's position. - Apply matching improvements to the macOS MapBubbleView. Co-Authored-By: bot_apk <apk@cognition.ai>
Original prompt from API User
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary
Two improvements to the inline map embed rendered by
show_places_on_map:1. Auto-fit with proper padding — The previous
showAnnotationscall fired before constraints were activated, so the map often had zero frame and couldn't compute a correct region. Now:showAnnotations: computesmin/maxlat/lon across all pins, enforces a minimum span (~500 m) so a single pin doesn't zoom to street-level, then appliessetRegion+setVisibleMapRect(edgePadding: 30pt)so markers aren't clipped by the rounded corners.2. User location blue dot —
mapView.showsUserLocation = trueis set when rendering the map. On iOS thedidUpdate userLocationdelegate re-fits the region once (one-shot viadidFitUserLocationflag) to include both all pins and the user's position. The existingviewFor annotation:guard (guard annotation is MapPlaceAnnotation else { return nil }) ensures the user location renders as the standard blue pulsing dot.Both iOS (
MessagingCell) and macOS (MapBubbleView) receive the same treatment.Link to Devin session: https://app.devin.ai/sessions/644363360037438eafa49e39e472287e