Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(assistant): camera listens on the canvas container, plugin facts regenerated

Mauriceef77b312fa31
diff --git a/client/src/components/Map/MapViewGL.test.tsx b/client/src/components/Map/MapViewGL.test.tsx
index d8b327e8d..6a1b4a0ac 100644
--- a/client/src/components/Map/MapViewGL.test.tsx
+++ b/client/src/components/Map/MapViewGL.test.tsx
@@ -47,8 +47,6 @@ const glMap = vi.hoisted(() => ({
getStyle: vi.fn().mockReturnValue({ layers: [] }),
isStyleLoaded: vi.fn().mockReturnValue(true),
getCanvasContainer: vi.fn(() => glCanvasContainer),
- // The assistant's camera listens on the map's container for the user's own moves.
- getContainer: vi.fn(() => glCanvasContainer),
getLayer: vi.fn().mockReturnValue(null),
queryRenderedFeatures: vi.fn().mockReturnValue([]),
querySourceFeatures: vi.fn().mockReturnValue([]),
diff --git a/client/src/components/Map/useAssistantCameraGL.test.ts b/client/src/components/Map/useAssistantCameraGL.test.ts
index ba7abed83..cdbb885db 100644
--- a/client/src/components/Map/useAssistantCameraGL.test.ts
+++ b/client/src/components/Map/useAssistantCameraGL.test.ts
@@ -31,7 +31,7 @@ function camera(key: string, over: Partial<AssistantCamera> = {}): AssistantCame
function setup(first: AssistantCamera | null, inside = false) {
const container = document.createElement('div');
const map = {
- getContainer: () => container,
+ getCanvasContainer: () => container,
getBounds: () => ({ contains: () => inside }),
fitBounds: vi.fn(),
easeTo: vi.fn(),
diff --git a/client/src/components/Map/useAssistantCameraGL.ts b/client/src/components/Map/useAssistantCameraGL.ts
index 27ece44bf..5278b001d 100644
--- a/client/src/components/Map/useAssistantCameraGL.ts
+++ b/client/src/components/Map/useAssistantCameraGL.ts
@@ -5,7 +5,8 @@ import type { AssistantCamera } from './mapViewContract';
/** The slice of the GL map the camera drives. */
export interface CameraMap {
- getContainer: () => HTMLElement;
+ /** Where the user drags, wheels and pinches the map; marker clicks are not moves. */
+ getCanvasContainer: () => HTMLElement;
getBounds: () => { contains: (lngLat: [number, number]) => boolean } | null;
fitBounds: (bounds: unknown, options: { padding: ViewportPadding; maxZoom: number; duration: number }) => unknown;
easeTo: (options: { center: [number, number]; duration: number }) => unknown;
@@ -32,7 +33,7 @@ interface AssistantCameraOptions {
* Leaflet map (one GL zoom step is a raster step lower).
*/
export function useAssistantCameraGL({ mapRef, mapReady, gl, camera, padding }: AssistantCameraOptions): void {
- const getContainer = useCallback(() => mapRef.current?.getContainer() ?? null, [mapRef]);
+ const getContainer = useCallback(() => mapRef.current?.getCanvasContainer() ?? null, [mapRef]);
const userMovedAt = useUserMoveClock(getContainer, mapReady);
const request = useCameraRequest(camera, userMovedAt);
diff --git a/plugin-sdk/src/generated/host-facts.ts b/plugin-sdk/src/generated/host-facts.ts
index acdd0936a..3ebba1e5d 100644
--- a/plugin-sdk/src/generated/host-facts.ts
+++ b/plugin-sdk/src/generated/host-facts.ts
@@ -409,6 +409,7 @@ export const KNOWN_ADDONS: string[] = [
'collections',
'roadtrip',
'tours',
+ 'ai_assistant',
];
/**