edit: allow using precise location (fix #604)
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/653/head
parent
0a79f30861
commit
e5a958916e
|
@ -74,8 +74,8 @@ import UndoIcon from 'vue-material-design-icons/UndoVariant.vue';
|
||||||
|
|
||||||
type NLocation = {
|
type NLocation = {
|
||||||
osm_id: number;
|
osm_id: number;
|
||||||
type: string;
|
type?: string;
|
||||||
icon: string;
|
icon?: string;
|
||||||
display_name: string;
|
display_name: string;
|
||||||
lat: string;
|
lat: string;
|
||||||
lon: string;
|
lon: string;
|
||||||
|
@ -155,6 +155,21 @@ export default defineComponent({
|
||||||
return;
|
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;
|
this.loading = true;
|
||||||
const q = window.encodeURIComponent(this.searchBar);
|
const q = window.encodeURIComponent(this.searchBar);
|
||||||
axios
|
axios
|
||||||
|
|
Loading…
Reference in New Issue