From 8aaea609a86ae3c09021096f3c1e3099f7b0ffec Mon Sep 17 00:00:00 2001 From: Harlan Wilton Date: Fri, 20 Mar 2026 02:13:43 +1100 Subject: [PATCH 1/2] fix: update e2e bundle snapshot hash --- test/e2e/base.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/base.test.ts b/test/e2e/base.test.ts index 95722af3..87aa2792 100644 --- a/test/e2e/base.test.ts +++ b/test/e2e/base.test.ts @@ -20,6 +20,6 @@ describe('base', async () => { await page.waitForTimeout(500) // get content of #script-src const text = await page.$eval('#script-src', el => el.textContent) - expect(text).toMatchInlineSnapshot(`"/foo/_scripts/assets/6bEy8slcRmYcRT4E2QbQZ1CMyWw9PpHA7L87BtvSs2U.js"`) + expect(text).toMatchInlineSnapshot(`"/foo/_scripts/assets/PHzhM8DFXcXVSSJF110cyV3pjg9cp8oWv_f4Dk2ax1w.js"`) }) }) From 55e75bfbd6a93e3b8df1a1d89c7ab61a30a66942 Mon Sep 17 00:00:00 2001 From: Harlan Wilton Date: Fri, 20 Mar 2026 02:42:48 +1100 Subject: [PATCH 2/2] feat: add `` component 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 --- docs/content/scripts/google-maps.md | 71 ++++++++++ .../pages/third-parties/google-maps/sfcs.vue | 21 +++ .../ScriptGoogleMapsOverlayView.vue | 128 ++++++++++++++++++ 3 files changed, 220 insertions(+) create mode 100644 src/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue diff --git a/docs/content/scripts/google-maps.md b/docs/content/scripts/google-maps.md index 223e9272..b4d1920e 100644 --- a/docs/content/scripts/google-maps.md +++ b/docs/content/scripts/google-maps.md @@ -434,6 +434,7 @@ All Google Maps SFC components must work within a ``{lang="htm - ``{lang="html"} - Line paths - ``{lang="html"} - Rectangular overlays - ``{lang="html"} - Heatmap visualization +- ``{lang="html"} - Render arbitrary Vue content at a lat/lng position ### Basic Usage @@ -531,6 +532,7 @@ ScriptGoogleMaps (root) ├── ScriptGoogleMapsAdvancedMarkerElement │ ├── ScriptGoogleMapsPinElement (optional) │ └── ScriptGoogleMapsInfoWindow (optional) +├── ScriptGoogleMapsOverlayView (arbitrary Vue content at a position) └── ScriptGoogleMapsCircle / Polygon / Polyline / Rectangle / HeatmapLayer ``` @@ -550,6 +552,75 @@ All SFC components accept an `options` prop matching their Google Maps API optio | `ScriptGoogleMapsPolyline` | `google.maps.PolylineOptions` | | | `ScriptGoogleMapsRectangle` | `google.maps.RectangleOptions` | | | `ScriptGoogleMapsHeatmapLayer` | `google.maps.visualization.HeatmapLayerOptions` | | +| `ScriptGoogleMapsOverlayView` | Explicit props (see below) | Renders Vue slot content at a position | + +### ``{lang="html"} + +Renders arbitrary Vue slot content at a map lat/lng position. Unlike `InfoWindow`, you have full control over HTML structure and styling. + +**Props:** + +| Prop | Type | Default | Description | +|---|---|---|---| +| `position` | `google.maps.LatLngLiteral` | (required) | Map anchor point | +| `anchor` | `OverlayAnchor` | `'bottom-center'` | Which point of the content aligns to the position | +| `offset` | `{ x: number, y: number }` | - | Pixel fine-tuning after anchor alignment | +| `pane` | `OverlayPane` | `'floatPane'` | Google Maps pane to render into | +| `zIndex` | `number` | - | Stack order | +| `blockMapInteraction` | `boolean` | `true` | Prevents clicks/drags from propagating to the map | + +**Popup on marker click:** + +```vue + + + +``` + +**Persistent label:** + +```vue + +``` + +::callout +The `blockMapInteraction` prop (default `true`) calls `google.maps.OverlayView.preventMapHitsAndGesturesFrom()`{lang="ts"} to stop clicks, taps, and drags from propagating through the overlay to the map. Set it to `false` for non-interactive overlays like labels. +:: ## [`useScriptGoogleMaps()`{lang="ts"}](/scripts/google-maps){lang="ts"} diff --git a/playground/pages/third-parties/google-maps/sfcs.vue b/playground/pages/third-parties/google-maps/sfcs.vue index cf58f3fb..d5b3f566 100644 --- a/playground/pages/third-parties/google-maps/sfcs.vue +++ b/playground/pages/third-parties/google-maps/sfcs.vue @@ -36,6 +36,8 @@ const heatmapLayerData = ref([]) const isCircleShown = ref(false) +const isOverlayViewShown = ref(false) + const googleMapsRef = useTemplateRef('googleMapsRef') whenever(() => googleMapsRef.value?.googleMaps, (googleMaps) => { @@ -191,6 +193,18 @@ whenever(() => googleMapsRef.value?.googleMaps, (googleMaps) => { }" /> + +
+ Custom Overlay +

Vue slot content with full reactivity

+
+
+ + {{ `${isOverlayViewShown ? 'Hide' : 'Show'} overlay view` }} + +