Add geolocation error feedback (re: #7376)

This commit is contained in:
Quincy Morgan
2020-02-27 14:10:31 -08:00
parent ad25f852fe
commit 135fd95305
3 changed files with 9 additions and 3 deletions
+1
View File
@@ -538,6 +538,7 @@ en:
key: L
title: Show My Location
locating: "Locating, please wait..."
location_unavailable: Your location is unavailable
inspector:
zoom_to:
key: Z
+2 -1
View File
@@ -680,7 +680,8 @@
"geolocate": {
"key": "L",
"title": "Show My Location",
"locating": "Locating, please wait..."
"locating": "Locating, please wait...",
"cannot_locate": "Your location is unavailable"
},
"inspector": {
"zoom_to": {
+6 -2
View File
@@ -5,6 +5,7 @@ import { tooltip } from '../util/tooltip';
import { geoExtent } from '../geo';
import { modeBrowse } from '../modes/browse';
import { svgIcon } from '../svg/icon';
import { uiFlash } from './flash';
import { uiLoading } from './loading';
import { uiTooltipHtml } from './tooltipHtml';
@@ -33,7 +34,7 @@ export function uiGeolocate(context) {
}
// This timeout ensures that we still call finish() even if
// the user declines to share their location in Firefox
_timeoutID = setTimeout(finish, 10000 /* 10sec */ );
_timeoutID = setTimeout(error, 10000 /* 10sec */ );
}
function zoomTo() {
@@ -52,6 +53,9 @@ export function uiGeolocate(context) {
}
function error() {
uiFlash()
.text(t('geolocate.location_unavailable'))
.iconName('#iD-icon-geolocate')();
finish();
}
@@ -66,7 +70,7 @@ export function uiGeolocate(context) {
}
return function(selection) {
if (!navigator.geolocation) return;
if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition) return;
_button = selection
.append('button')