Skip to content

Recenter button when map drifts off the user#6

Merged
dfalling merged 1 commit into
mainfrom
map-recenter-button
May 26, 2026
Merged

Recenter button when map drifts off the user#6
dfalling merged 1 commit into
mainfrom
map-recenter-button

Conversation

@dfalling
Copy link
Copy Markdown
Owner

Summary

  • Track viewport center after each region change and flag the map as off-center when it drifts more than 20% of the visible span (either axis) from the user's location.
  • Render a floating recenter button (bottom-right) while off-center; tapping it flies the camera back to the user at USER_ZOOM (same zoom we use for the initial framing).

Test plan

  • Grant location permission on first launch; map flies to user and no button is visible.
  • Pan the map far enough that the user dot moves clearly off-center → button appears.
  • Tap the button → camera flies back to the user and the button disappears.
  • Small pans that keep the user roughly centered do not show the button.

🤖 Generated with Claude Code

Tracks viewport center after each region change and compares it to the
user's location. When the user has panned more than 20% of the visible
span away in either axis, surface a floating button that flies the
camera back to their location at the same zoom level we use initially.

Positioned with safe-area insets plus a fixed clearance so it sits above
the "signed in as…" bar at the bottom of App.tsx.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dfalling dfalling force-pushed the map-recenter-button branch from c7861eb to 46d6e26 Compare May 26, 2026 00:14
@dfalling dfalling merged commit 0f738f9 into main May 26, 2026
2 checks passed
@dfalling dfalling deleted the map-recenter-button branch May 26, 2026 00: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