Skip to content

Add reset zoom button to interactive map#875

Open
nicksspirit wants to merge 1 commit intoBlackPythonDevs:gh-pagesfrom
nicksspirit:gh-pages
Open

Add reset zoom button to interactive map#875
nicksspirit wants to merge 1 commit intoBlackPythonDevs:gh-pagesfrom
nicksspirit:gh-pages

Conversation

@nicksspirit
Copy link
Copy Markdown

  • What: Adds a reset zoom button to the interactive map on the about page. The button provides users with a quick way to return to the initial full-world view after panning or zooming to explore specific regions.

  • Why: Users may get "lost" while exploring the map and had no easy way to return to the initial state. This feature improves usability by providing a clearly visible, styled button that resets the map to its original center and zoom level.

  • How: A custom HTML/JS control is injected into the Folium map after generation. When clicked, the button resets the map view to center coordinates [20, 0] and zoom level 2. The dark-themed styling ensures it matches the existing map controls and UI elements.

Issue Link 🔗:

Issue: #874

Type of Change

  • Bug fix 🐞
  • New feature/page
  • Documentation update
  • Other

Checklist ✅

  • Followed the Code of Conduct and Contribution Guide
  • Ran pre-commit run --all
  • All tests pass locally
  • Added tests (if applicable)
  • Documentation updated (if applicable) - Code is self-documenting with inline comments

Additional Notes & Screenshots

  • The reset button is positioned at top: 10px; right: 50px to avoid overlap with Leaflet's default zoom controls
  • Button styling (#3a3a3a background, #5a5a5a border) is designed to match the CartoDB dark_matter basemap theme
  • Includes hover effects for improved UX (lighter background and subtle shadow)
  • The implementation uses the standard Leaflet setView() method to ensure compatibility with existing map functionality
  • On PR merge, GitHub Actions will regenerate map.html with the updated map control

- Implement custom HTML/JS control for resetting map view
- Button positioned top-right, styled to match dark theme
- Resets map to initial center [20, 0] and zoom level 2
- Includes hover effects for better UX
@lazouich
Copy link
Copy Markdown
Contributor

I see the button added, but when I click it, the map does not reset

@kjaymiller kjaymiller self-requested a review April 14, 2026 13:22
@kjaymiller
Copy link
Copy Markdown
Contributor

@nicksspirit - please address the comment from @lazouich above

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.

3 participants