node page: fix bug if navigator.geolocation.watchPosition() returns 0 as id
This commit is contained in:
parent
cf80198928
commit
b7f07ccbe0
|
@ -94,13 +94,13 @@ export class NodeView extends View {
|
||||||
this.btnGPS.classList.add('btn');
|
this.btnGPS.classList.add('btn');
|
||||||
this.btnGPS.innerHTML = 'Start follow position';
|
this.btnGPS.innerHTML = 'Start follow position';
|
||||||
this.btnGPS.addEventListener('click', () => {
|
this.btnGPS.addEventListener('click', () => {
|
||||||
if (this.editLocationGPS) {
|
if (this.editLocationGPS != null) {
|
||||||
if (this.btnGPS.innerHTML === 'Stop following') {
|
if (this.btnGPS.innerHTML === 'Stop following') {
|
||||||
updatePosition();
|
updatePosition();
|
||||||
}
|
}
|
||||||
this.btnGPS.innerHTML = 'Start follow position';
|
this.btnGPS.innerHTML = 'Start follow position';
|
||||||
navigator.geolocation.clearWatch(this.editLocationGPS);
|
navigator.geolocation.clearWatch(this.editLocationGPS);
|
||||||
this.editLocationGPS = false;
|
this.editLocationGPS = null;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ export class NodeView extends View {
|
||||||
this.hostnameInput.value = node.hostname;
|
this.hostnameInput.value = node.hostname;
|
||||||
this.ownerInput.value = node.owner;
|
this.ownerInput.value = node.owner;
|
||||||
|
|
||||||
if (!this.editLocationGPS && node.location && node.location.latitude && node.location.longitude) {
|
if (this.editLocationGPS == null && node.location && node.location.latitude && node.location.longitude) {
|
||||||
// eslint-disable-next-line one-var
|
// eslint-disable-next-line one-var
|
||||||
const latlng = [node.location.latitude, node.location.longitude];
|
const latlng = [node.location.latitude, node.location.longitude];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue