Skip to content

feat: add <ScriptGoogleMapsOverlayView> component - #658

Closed
harlan-zw wants to merge 2 commits into
mainfrom
feat/overlay-view-component
Closed

feat: add <ScriptGoogleMapsOverlayView> component#658
harlan-zw wants to merge 2 commits into
mainfrom
feat/overlay-view-component

Conversation

@harlan-zw

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Closes#657

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

InfoWindow forces a predefined HTML structure and styling. This adds <ScriptGoogleMapsOverlayView>, which renders arbitrary Vue slot content at a map lat/lng position with full styling control.

Features:

  • Anchor-based positioning: anchor prop controls alignment (e.g. bottom-center, center) via CSS transforms, no layout measurement needed
  • Map interaction blocking: blockMapInteraction (default true) prevents clicks/drags from propagating to the map
  • No flash: content starts hidden, revealed after first draw() positions it
  • Reactive: repositions on prop changes, Vue slot reactivity preserved via hidden-container + appendChild pattern (same as InfoWindow)
  • Configurable pane, zIndex, and pixel offset
  • Playground demo and docs added

Renders arbitrary Vue slot content at a map lat/lng position with full
styling control, solving the limitation of InfoWindow's predefined HTML
structure. Includes anchor-based positioning, map interaction blocking,
and flash prevention.
Closes#657
@vercel

vercelBot commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
scripts-playgroundReadyReadyPreview, CommentMar 19, 2026 3:45pm

@coderabbitai

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This pull request introduces ScriptGoogleMapsOverlayView, a new Vue component for rendering custom content on Google Maps using the native OverlayView API. The change includes the component implementation with props for positioning, anchoring, offsets, pane selection, z-index, and map interaction blocking. Documentation was added describing the component, its props, and usage examples. A playground example demonstrates the component with a toggle control. A test snapshot was updated to reflect bundled asset changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

The change introduces heterogeneous modifications across documentation, implementation, and examples. The component implementation contains non-trivial logic for OverlayView abstraction, lat/lng-to-pixel coordinate conversion, anchor-based CSS transforms, prop watching, and overlay remounting. These require careful verification of correctness, prop handling, and edge cases. Documentation completeness and playground example clarity also need assessment.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title accurately describes the main change: adding a new Vue component <ScriptGoogleMapsOverlayView>. It is concise, clear, and follows conventional commits format.
Description check✅ PassedThe description includes linked issue reference, appropriate type selection, and detailed feature list explaining the component's functionality and design decisions.
Linked Issues check✅ PassedThe PR successfully implements the custom overlay component requested in issue #657, providing arbitrary Vue content rendering at map coordinates with full styling control and interaction management.
Out of Scope Changes check✅ PassedAll changes are directly related to the new component feature: the main component implementation, playground demo, documentation, and a test snapshot update for bundled assets.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Important

Merge conflicts detected (Beta)

  • Resolve merge conflict in branch feat/overlay-view-component
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/overlay-view-component
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue (1)

99-117: Consider extracting the remount logic.

The remount pattern is duplicated for pane and blockMapInteraction watchers. This is a minor readability nit.

♻️ Optional: extract remount helper
+function remountOverlay() {+ if (overlay.value) {+ const map = overlay.value.getMap()+ overlay.value.setMap(null)+ if (map)+ overlay.value.setMap(map as google.maps.Map)+ }+}+
// Pane change requires remount (setMap cycles onRemove + onAdd + draw)
-watch(() => props.pane, () => {- if (overlay.value) {- const map = overlay.value.getMap()- overlay.value.setMap(null)- if (map)- overlay.value.setMap(map as google.maps.Map)- }-})+watch(() => props.pane, remountOverlay)
// blockMapInteraction change requires remount to re-apply preventMapHitsAndGesturesFrom
-watch(() => props.blockMapInteraction, () => {- if (overlay.value) {- const map = overlay.value.getMap()- overlay.value.setMap(null)- if (map)- overlay.value.setMap(map as google.maps.Map)- }-})+watch(() => props.blockMapInteraction, remountOverlay)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue` around
lines 99 - 117, Duplicate remount logic exists in the two watchers for
props.pane and props.blockMapInteraction; extract that into a single helper
function (e.g., remountOverlay or doRemount) that checks overlay.value, saves
const map = overlay.value.getMap(), calls overlay.value.setMap(null), then if
map re-attaches with overlay.value.setMap(map as google.maps.Map); replace both
watcher bodies to call this helper to remove duplication and improve readability
while keeping existing behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue`:
- Around line 99-117: Duplicate remount logic exists in the two watchers for
props.pane and props.blockMapInteraction; extract that into a single helper
function (e.g., remountOverlay or doRemount) that checks overlay.value, saves
const map = overlay.value.getMap(), calls overlay.value.setMap(null), then if
map re-attaches with overlay.value.setMap(map as google.maps.Map); replace both
watcher bodies to call this helper to remove duplication and improve readability
while keeping existing behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 97d42e34-5104-4f43-98bc-983c6bb22912

📥 Commits

Reviewing files that changed from the base of the PR and between fb54985 and 55e75bf.

📒 Files selected for processing (4)
  • docs/content/scripts/google-maps.md
  • playground/pages/third-parties/google-maps/sfcs.vue
  • src/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue
  • test/e2e/base.test.ts

@harlan-zwharlan-zw mentioned this pull request Mar 20, 2026
6 tasks
@harlan-zwharlan-zw mentioned this pull request Mar 26, 2026
Sign up for freeto 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.

<ScriptGoogleMapsOverlayView> component

1 participant

@harlan-zw