edit: allow using precise location (fix #604)

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/653/head
Varun Patil 2023-04-24 12:31:08 -07:00
parent 0a79f30861
commit e5a958916e
1 changed files with 17 additions and 2 deletions

View File

@ -74,8 +74,8 @@ import UndoIcon from 'vue-material-design-icons/UndoVariant.vue';
type NLocation = {
osm_id: number;
type: string;
icon: string;
type?: string;
icon?: string;
display_name: string;
lat: string;
lon: string;
@ -155,6 +155,21 @@ export default defineComponent({
return;
}
// Check if searchbar is already a coordinate
const coords = this.searchBar.split(',');
if (coords.length === 2) {
const lat = Number(coords[0].trim());
const lon = Number(coords[1].trim());
if (!isNaN(lat) && !isNaN(lon)) {
return this.select({
osm_id: 0,
display_name: `${lat.toFixed(6)}, ${lon.toFixed(6)}`,
lat: lat.toFixed(6),
lon: lon.toFixed(6),
});
}
}
this.loading = true;
const q = window.encodeURIComponent(this.searchBar);
axios