Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions client/web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/web/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
13 changes: 8 additions & 5 deletions client/web/src/lit/custom-components/google_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -175,25 +173,28 @@ export class GoogleMap extends A2uiLitElement<typeof GoogleMapApi> {
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;

position && (marker.position = position);
placeId && (marker.placeId = placeId);
label && (marker.label = label);
collisionBehavior && (marker.collisionBehavior = collisionBehavior);
(zIndex != null) && (marker.zIndex = zIndex);

return marker;
Expand Down Expand Up @@ -287,6 +288,7 @@ export class GoogleMap extends A2uiLitElement<typeof GoogleMapApi> {
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);
Expand All @@ -295,6 +297,7 @@ export class GoogleMap extends A2uiLitElement<typeof GoogleMapApi> {
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);
Expand Down Expand Up @@ -358,4 +361,4 @@ export class GoogleMap extends A2uiLitElement<typeof GoogleMapApi> {
export const A2uiGoogleMap = {
...GoogleMapApi,
tagName: "a2ui-googlemap",
};
};
Loading