mirror of
https://github.com/immich-app/immich.git
synced 2026-01-15 14:33:16 -08:00
feat(web): Add coordinate pair location searching. (#24799)
* feat(web): Add coordinate pair searching within the change location modal. Adds simple logic to try and parse a coordinate pair in the format `LATITUDE, LONGITUDE` as provided from Google Maps if a coordinate is copied to update the coordinates automatically. * Add checks for valid coordinate pairs * Update formatting and fix linting issues
This commit is contained in:
@@ -86,6 +86,27 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to parse coordinate pair from search input in the format `LATITUDE, LONGITUDE` as floats
|
||||
const coordinateParts = searchWord.split(',').map((part) => part.trim());
|
||||
if (coordinateParts.length === 2) {
|
||||
const coordinateLat = Number.parseFloat(coordinateParts[0]);
|
||||
const coordinateLng = Number.parseFloat(coordinateParts[1]);
|
||||
|
||||
if (
|
||||
!Number.isNaN(coordinateLat) &&
|
||||
!Number.isNaN(coordinateLng) &&
|
||||
coordinateLat >= -90 &&
|
||||
coordinateLat <= 90 &&
|
||||
coordinateLng >= -180 &&
|
||||
coordinateLng <= 180
|
||||
) {
|
||||
places = [];
|
||||
showLoadingSpinner = false;
|
||||
handleUseSuggested(coordinateLat, coordinateLng);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
searchPlaces({ name: searchWord })
|
||||
.then((searchResult) => {
|
||||
// skip result when a newer search is happening
|
||||
|
||||
Reference in New Issue
Block a user