From b988eeb7c06d1b320de65b646ea119addf2814bb Mon Sep 17 00:00:00 2001 From: Peter Date: Wed, 10 Jul 2024 17:52:28 +0200 Subject: [PATCH] clean up --- src/sidebar/search/AddressInput.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/sidebar/search/AddressInput.tsx b/src/sidebar/search/AddressInput.tsx index 02b69c76..684c01b5 100644 --- a/src/sidebar/search/AddressInput.tsx +++ b/src/sidebar/search/AddressInput.tsx @@ -23,7 +23,7 @@ export interface AddressInputProps { point: QueryPoint points: QueryPoint[] onCancel: () => void - onAddressSelected: (queryText: string, coord: Coordinate | undefined, bbox: Bbox | undefined) => void + onAddressSelected: (queryText: string, coord: Coordinate | undefined) => void onChange: (value: string) => void clearDragDrop: () => void moveStartIndex: number @@ -114,20 +114,19 @@ export default function AddressInput(props: AddressInputProps) { // try to parse input as coordinate. Otherwise query nominatim const coordinate = textToCoordinate(text) if (coordinate) { - props.onAddressSelected(text, coordinate, getBBoxFromCoord(coordinate)) + props.onAddressSelected(text, coordinate) } else if (autocompleteItems.length > 0) { // by default use the first result, otherwise the highlighted one getApi().geocode(text, 'nominatim').then(result => { if (result && result.hits.length > 0) { const hit: GeocodingHit = result.hits[0] const res = nominatimHitToItem(hit) - const bbox = hit.extent ? hit.extent : getBBoxFromCoord(hit.point) - props.onAddressSelected(res.mainText + ', ' + res.secondText, hit.point, bbox) + props.onAddressSelected(res.mainText + ', ' + res.secondText, hit.point) } else { const index = highlightedResult >= 0 ? highlightedResult : 0 const item = autocompleteItems[index] if (item instanceof GeocodingItem) - props.onAddressSelected(item.toText(), item.point, item.bbox) + props.onAddressSelected(item.toText(), item.point) } }) } @@ -222,7 +221,7 @@ export default function AddressInput(props: AddressInputProps) { setHasFocus(false) if (item instanceof GeocodingItem) { hideSuggestions() - props.onAddressSelected(item.toText(), item.point, item.bbox) + props.onAddressSelected(item.toText(), item.point) } else if (item instanceof SelectCurrentLocationItem) { hideSuggestions() onCurrentLocationSelected(props.onAddressSelected)