From 85a43c7890f473a2ac4fd51b3524275a70c88571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Celine=20P=C3=B6hl?= Date: Mon, 3 Jun 2024 17:30:53 +0200 Subject: [PATCH] Fly to location works MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Celine Pöhl --- frontend/src/components/PopUp/SearchBar.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/PopUp/SearchBar.tsx b/frontend/src/components/PopUp/SearchBar.tsx index 2a322f77..45efa97e 100644 --- a/frontend/src/components/PopUp/SearchBar.tsx +++ b/frontend/src/components/PopUp/SearchBar.tsx @@ -39,7 +39,7 @@ const SearchBar: React.FC = () => { } const results = await provider.search({ query }); const transformedResults: MapSelection[] = results.map((result) => ({ - coordinates: new LatLng(result.x, result.y), + coordinates: new LatLng(result.y, result.x), displayName: result.label, })); callback(transformedResults); @@ -84,7 +84,6 @@ const SearchBar: React.FC = () => { const onItemSelected = (item: MapSelection) => { setTimeout(() => { - alert(item.displayName); flyToLocation(new LatLng(item.coordinates.lat, item.coordinates.lng)); }, 400); }; @@ -92,7 +91,7 @@ const SearchBar: React.FC = () => { const flyToLocation = (targetPosition: LatLng) => { const { mapInstance } = currentMapCache; if (mapInstance) { - mapInstance.flyTo(targetPosition, 13, { animate: true, duration: 10 }); + mapInstance.flyTo(targetPosition, 13, { animate: true, duration: 5 }); } else console.log("no map instance"); };