mirror of
https://github.com/samsonjs/immich.git
synced 2026-04-27 15:07:45 +00: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:
parent
abea5a53de
commit
a1aa2b807b
1 changed files with 21 additions and 0 deletions
|
|
@ -86,6 +86,27 @@
|
||||||
return;
|
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 })
|
searchPlaces({ name: searchWord })
|
||||||
.then((searchResult) => {
|
.then((searchResult) => {
|
||||||
// skip result when a newer search is happening
|
// skip result when a newer search is happening
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue