Conversation
|
🚀 Deployed on https://690ec0ef82d28323c20768c9--opengeos.netlify.app |
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new add_popup method to the MapLibre widget that simplifies popup configuration with support for both click and hover triggers, custom templates, and selective property display.
- Introduces
add_popupmethod as a more user-friendly alternative toenable_feature_popup - Adds hover trigger support for popups in addition to the default click trigger
- Implements template-based popup content with variable interpolation
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| anymap/maplibre.py | Adds new add_popup method with simplified API for configuring popups with trigger modes and templates |
| anymap/static/maplibre_widget.js | Implements template rendering and trigger-based (click/hover) popup behavior in the JavaScript widget |
| docs/examples/maplibre/maplibre_add_vector.ipynb | Updates example to demonstrate the new add_popup method with hover trigger |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| layer_id: str, | ||
| prop: Optional[str] = None, | ||
| template: Optional[str] = None, | ||
| trigger: str = "click", |
There was a problem hiding this comment.
The trigger parameter should be validated to ensure it's either "click" or "hover". Currently, invalid values like "double-click" or "focus" would be silently passed to JavaScript without raising an error, potentially causing unexpected behavior.
Consider adding validation like:
if trigger not in ("click", "hover"):
raise ValueError(f"trigger must be 'click' or 'hover', got '{trigger}'")Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.