Skip to content

Add add_popup method#115

Merged
giswqs merged 4 commits intomainfrom
popup
Nov 8, 2025
Merged

Add add_popup method#115
giswqs merged 4 commits intomainfrom
popup

Conversation

@giswqs
Copy link
Copy Markdown
Member

@giswqs giswqs commented Nov 8, 2025

No description provided.

Copilot AI review requested due to automatic review settings November 8, 2025 03:54
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 8, 2025

@github-actions github-actions Bot temporarily deployed to pull request November 8, 2025 03:55 Inactive
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_popup method as a more user-friendly alternative to enable_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.

Comment thread anymap/maplibre.py
layer_id: str,
prop: Optional[str] = None,
template: Optional[str] = None,
trigger: str = "click",
Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}'")

Copilot uses AI. Check for mistakes.
Comment thread anymap/maplibre.py Outdated
Comment thread anymap/static/maplibre_widget.js Outdated
giswqs and others added 2 commits November 7, 2025 22:59
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions github-actions Bot temporarily deployed to pull request November 8, 2025 04:01 Inactive
@github-actions github-actions Bot temporarily deployed to pull request November 8, 2025 04:02 Inactive
@giswqs giswqs merged commit 6135886 into main Nov 8, 2025
8 checks passed
@giswqs giswqs deleted the popup branch November 8, 2025 04:03
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.

2 participants