forked from MapComplete/MapComplete
More cleanup, first somewhat working version of #171
This commit is contained in:
parent
1f93923820
commit
bef684aec7
19 changed files with 439 additions and 135 deletions
|
@ -230,7 +230,7 @@ export default class GeoLocationHandler extends VariableUiElement {
|
|||
navigator?.permissions
|
||||
?.query({name: "geolocation"})
|
||||
?.then(function (status) {
|
||||
console.log("Geolocation is already", status);
|
||||
console.log("Geolocation permission is ", status.state);
|
||||
if (status.state === "granted") {
|
||||
self.StartGeolocating(forceZoom);
|
||||
}
|
||||
|
@ -289,7 +289,6 @@ export default class GeoLocationHandler extends VariableUiElement {
|
|||
|
||||
private StartGeolocating(zoomToGPS = true) {
|
||||
const self = this;
|
||||
console.log("Starting geolocation");
|
||||
|
||||
this._lastUserRequest = zoomToGPS ? new Date() : new Date(0);
|
||||
if (self._permission.data === "denied") {
|
||||
|
@ -301,8 +300,6 @@ export default class GeoLocationHandler extends VariableUiElement {
|
|||
this.MoveToCurrentLoction(16);
|
||||
}
|
||||
|
||||
console.log("Searching location using GPS");
|
||||
|
||||
if (self._isActive.data) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -184,8 +184,8 @@ export default class OverpassFeatureSource implements FeatureSource, FeatureSour
|
|||
return;
|
||||
}
|
||||
this.runningQuery.setData(true);
|
||||
overpass.queryGeoJson(queryBounds,
|
||||
function (data, date) {
|
||||
overpass.queryGeoJson(queryBounds).
|
||||
then(([data, date]) => {
|
||||
self._previousBounds.get(z).push(queryBounds);
|
||||
self.retries.setData(0);
|
||||
const features = data.features.map(f => ({feature: f, freshness: date}));
|
||||
|
@ -197,12 +197,12 @@ export default class OverpassFeatureSource implements FeatureSource, FeatureSour
|
|||
console.error("Got the overpass response, but could not process it: ", e, e.stack)
|
||||
}
|
||||
self.runningQuery.setData(false);
|
||||
},
|
||||
function (reason) {
|
||||
})
|
||||
.catch((reason) => {
|
||||
self.retries.data++;
|
||||
self.ForceRefresh();
|
||||
self.timeout.setData(self.retries.data * 5);
|
||||
console.error(`QUERY FAILED (retrying in ${5 * self.retries.data} sec) due to ${reason}`);
|
||||
console.error(`QUERY FAILED (retrying in ${5 * self.retries.data} sec) due to`, reason);
|
||||
self.retries.ping();
|
||||
self.runningQuery.setData(false);
|
||||
|
||||
|
|
|
@ -8,8 +8,6 @@ export default class TitleHandler {
|
|||
constructor(state) {
|
||||
const currentTitle: UIEventSource<string> = state.selectedElement.map(
|
||||
selected => {
|
||||
console.log("UPdating title")
|
||||
|
||||
const layout = state.layoutToUse.data
|
||||
const defaultTitle = Translations.WT(layout?.title)?.txt ?? "MapComplete"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue