Conversation
|
🚀 Deployed on https://690e8136fb9129a95e83996f--opengeos.netlify.app |
There was a problem hiding this comment.
Pull Request Overview
This PR adds programmatic control for collapsing and expanding the Geoman drawing toolbar. The implementation includes three new Python methods and their corresponding JavaScript handlers, along with notebook examples demonstrating the functionality.
- Adds
collapse_geoman_control(),expand_geoman_control(), andtoggle_geoman_control()methods to the MapLibre API - Implements JavaScript handlers with concurrency protection to prevent rapid successive operations
- Updates the Geoman example notebook to demonstrate the new collapse/expand functionality
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| anymap/maplibre.py | Adds three new methods for controlling Geoman toolbar collapse state |
| anymap/static/maplibre_widget.js | Implements JavaScript handlers with concurrency control and refactors collapse state logic |
| docs/examples/maplibre_geoman.ipynb | Adds demonstration cells for collapse/expand/toggle functionality and updates cell IDs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "2", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "m.expand_geoman_control()" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "3", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "m.collapse_geoman_control()" | ||
| ] |
There was a problem hiding this comment.
These cells demonstrate expand_geoman_control() and collapse_geoman_control() without any context or explanation, immediately after creating the map. This is confusing for users following the notebook sequentially. Consider removing these early cells since the same functionality is properly documented later in the notebook (lines 169-194) with clear explanations and context.
| } | ||
|
|
||
| // Track ongoing collapse/expand operations to prevent rapid successive clicks | ||
| let geomanCollapseInProgress = false; |
There was a problem hiding this comment.
The global geomanCollapseInProgress flag is shared across all map instances on the same page. If multiple maps with Geoman controls exist, collapsing/expanding one map's control could prevent operations on another map's control. Consider making this flag instance-specific by storing it on the map element or geomanInstance object (e.g., el._geomanCollapseInProgress or instance._collapseInProgress).
No description provided.