From 8dd824f98e12a81642ec2ce18d71c7cf4d18abdf Mon Sep 17 00:00:00 2001 From: Chris Bauer Date: Wed, 20 May 2026 15:01:40 -0700 Subject: [PATCH] feat: Updating collision behavior of auto-generated route pins --- client/web/package-lock.json | 10 +++++++--- client/web/package.json | 2 +- client/web/src/lit/custom-components/google_map.ts | 13 ++++++++----- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/client/web/package-lock.json b/client/web/package-lock.json index 54d4158..2f352b3 100644 --- a/client/web/package-lock.json +++ b/client/web/package-lock.json @@ -1,12 +1,12 @@ { "name": "@googlemaps/a2ui", - "version": "0.1.3", + "version": "0.1.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@googlemaps/a2ui", - "version": "0.1.2", + "version": "0.1.4", "license": "Apache-2.0", "dependencies": { "@a2a-js/sdk": "^0.3.8", @@ -95,6 +95,7 @@ "resolved": "https://registry.npmjs.org/@a2ui/markdown-it/-/markdown-it-0.0.3.tgz", "integrity": "sha512-ni/aK2oeBcjEESTO+XE+CidDb0N4aOzYL14XSYBAdAH2E7jmsbuUyHEKf4FQyYK0f8AA0C5thkZ09qPV2C3ikA==", "license": "Apache-2.0", + "peer": true, "dependencies": { "dompurify": "^3.3.1", "markdown-it": "^14.1.0" @@ -108,6 +109,7 @@ "resolved": "https://registry.npmjs.org/@a2ui/web_core/-/web_core-0.9.2.tgz", "integrity": "sha512-EOfhLOF7tnpPmNq4y116k3gxWdrXQW8h3dhKF0pC++21zLZnCSLSHl6zgQFG+kPeVAZb64t+sQiRXlnyS8+RBg==", "license": "Apache-2.0", + "peer": true, "dependencies": { "@preact/signals-core": "^1.13.0", "date-fns": "^4.1.0", @@ -1121,7 +1123,8 @@ "version": "0.2.2", "resolved": "https://registry.npmjs.org/signal-polyfill/-/signal-polyfill-0.2.2.tgz", "integrity": "sha512-p63Y4Er5/eMQ9RHg0M0Y64NlsQKpiu6MDdhBXpyywRuWiPywhJTpKJ1iB5K2hJEbFZ0BnDS7ZkJ+0AfTuL37Rg==", - "license": "Apache-2.0" + "license": "Apache-2.0", + "peer": true }, "node_modules/signal-utils": { "version": "0.21.1", @@ -1325,6 +1328,7 @@ "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", "license": "MIT", + "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/client/web/package.json b/client/web/package.json index 40717dc..81c4c16 100644 --- a/client/web/package.json +++ b/client/web/package.json @@ -1,6 +1,6 @@ { "name": "@googlemaps/a2ui", - "version": "0.1.3", + "version": "0.1.4", "description": "Maps Agentic UI Toolkit Library", "main": "./dist/src/lit/index.js", "types": "./dist/src/lit/index.d.ts", diff --git a/client/web/src/lit/custom-components/google_map.ts b/client/web/src/lit/custom-components/google_map.ts index 74973ad..5102740 100644 --- a/client/web/src/lit/custom-components/google_map.ts +++ b/client/web/src/lit/custom-components/google_map.ts @@ -23,8 +23,6 @@ import { z } from 'zod'; import { ComponentApi, DynamicNumberSchema, DynamicStringSchema } from "@a2ui/web_core/v0_9"; import { A2uiLitElement, A2uiController } from "@a2ui/lit/v0_9"; - - const LatLngSchema = z.object({ lat: DynamicNumberSchema, lng: DynamicNumberSchema, @@ -175,18 +173,20 @@ export class GoogleMap extends A2uiLitElement { lat: marker.lat ?? 0 as number, lng: marker.lng ?? 0 as number, label: marker.label as string, - placeId: marker.placeId as string + placeId: marker.placeId as string, + collisionBehavior: marker.collisionBehavior as google.maps.CollisionBehavior | undefined, })).filter(filterMarkerFn); } return []; } - #create3DMarkerElement({ position, placeId, label, zIndex }: { + #create3DMarkerElement({ position, placeId, label, zIndex, collisionBehavior }: { position?: google.maps.LatLngLiteral, placeId?: string | null, label?: string | null, zIndex?: number | null, + collisionBehavior?: google.maps.CollisionBehavior, }) { const marker = document.createElement("gmp-marker-3d") as any; marker.autofitsCamera = true; @@ -194,6 +194,7 @@ export class GoogleMap extends A2uiLitElement { position && (marker.position = position); placeId && (marker.placeId = placeId); label && (marker.label = label); + collisionBehavior && (marker.collisionBehavior = collisionBehavior); (zIndex != null) && (marker.zIndex = zIndex); return marker; @@ -287,6 +288,7 @@ export class GoogleMap extends A2uiLitElement { const originMarker = this.#create3DMarkerElement({ position: { lat: route.origin.lat as number, lng: route.origin.lng as number }, label: route.origin.label as string || "Origin", + collisionBehavior: google.maps.CollisionBehavior.OPTIONAL_AND_HIDES_LOWER_PRIORITY, placeId: route.origin.placeId as string, }); this.map3dElement.appendChild(originMarker); @@ -295,6 +297,7 @@ export class GoogleMap extends A2uiLitElement { const destMarker = this.#create3DMarkerElement({ position: { lat: route.destination.lat as number, lng: route.destination.lng as number }, label: route.destination.label as string || "Destination", + collisionBehavior: google.maps.CollisionBehavior.OPTIONAL_AND_HIDES_LOWER_PRIORITY, placeId: route.destination.placeId as string, }); this.map3dElement.appendChild(destMarker); @@ -358,4 +361,4 @@ export class GoogleMap extends A2uiLitElement { export const A2uiGoogleMap = { ...GoogleMapApi, tagName: "a2ui-googlemap", -}; \ No newline at end of file +};