Add reset zoom button to interactive map#875
Open
nicksspirit wants to merge 1 commit intoBlackPythonDevs:gh-pagesfrom
Open
Add reset zoom button to interactive map#875nicksspirit wants to merge 1 commit intoBlackPythonDevs:gh-pagesfrom
nicksspirit wants to merge 1 commit intoBlackPythonDevs:gh-pagesfrom
Conversation
- 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
Contributor
|
I see the button added, but when I click it, the map does not reset |
Contributor
|
@nicksspirit - please address the comment from @lazouich above |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Checklist ✅
pre-commit run --allAdditional Notes & Screenshots
top: 10px; right: 50pxto avoid overlap with Leaflet's default zoom controls#3a3a3abackground,#5a5a5aborder) is designed to match the CartoDB dark_matter basemap themesetView()method to ensure compatibility with existing map functionality