Add zoom to agent fly to location

This commit is contained in:
Ethan Morchy
2026-08-08 17:08:13 -07:00
parent 6843183c16
commit b9d8be146d
2 changed files with 7 additions and 3 deletions
+3 -2
View File
@@ -436,6 +436,7 @@ export default function Dashboard() {
const [flyToLocation, setFlyToLocation] = useState<{
lat: number;
lng: number;
zoom?: number;
ts: number;
} | null>(null);
@@ -504,8 +505,8 @@ export default function Dashboard() {
// Agent fly_to handler (sar_focus_aoi etc.) — wired here now that
// setFlyToLocation is in scope. show_image is routed through
// useAgentActions at the top of Dashboard.
useAgentActions(handleMapRightClick, ({ lat, lng }) => {
setFlyToLocation({ lat, lng, ts: Date.now() });
useAgentActions(handleMapRightClick, ({ lat, lng, zoom }) => {
setFlyToLocation({ lat, lng, zoom, ts: Date.now() });
}, secondaryBootReady);
// Eavesdrop Mode State
+4 -1
View File
@@ -752,9 +752,12 @@ const MaplibreViewer = ({
useEffect(() => {
if (flyToLocation && mapRef.current) {
// Agent moves (sar_focus_aoi) carry their own zoom: a world-view revert
// asks for ~2, a tight AOI for ~9. Ignoring it pinned every move at 8,
// which turned "show the whole world" into a patch of empty ocean.
mapRef.current.flyTo({
center: [flyToLocation.lng, flyToLocation.lat],
zoom: 8,
zoom: flyToLocation.zoom ?? 8,
duration: 1500,
});
}