going to the source to debug mobile gps

This commit is contained in:
Zakary Timson 2019-09-02 19:07:58 -04:00
parent 4ad5131d35
commit 7633a41185
2 changed files with 8 additions and 8 deletions

View File

@ -16,7 +16,7 @@
<div *ngIf="position" class="text-white">
Heading:
<span *ngIf="position.heading == null" class="text-danger">No Heading</span>
<span *ngIf="!isNaN(position.heading)">{{position.heading | number : '1.0-0'}}°</span>
<span *ngIf="position.heading != null">{{position.heading | number : '1.0-0'}}°</span>
<br>
Latitude: {{position.latitude | number : '0.0-5'}}
<br>

View File

@ -114,15 +114,15 @@ export class MapComponent implements OnDestroy, OnInit {
});
// Display location information & submit it
this.physicsService.info.pipe(filter(coord => !!coord)).subscribe(pos => {
console.log('painting');
if (!this.position) this.center({lat: pos.latitude, lng: pos.longitude});
this.physicsService.position.pipe(filter(coord => !!coord)).subscribe(pos => {
console.log('painting', pos);
if (!this.position) this.center({lat: pos.coords.latitude, lng: pos.coords.longitude});
if (this.positionMarker.arrow) this.map.delete(this.positionMarker.arrow);
if (this.positionMarker.circle) this.map.delete(this.positionMarker.circle);
this.positionMarker.arrow = this.map.newMarker({latlng: {lat: pos.latitude, lng: pos.longitude}, noSelect: true, noDelete: true, noDeleteTool: true, icon: 'arrow', rotationAngle: pos.heading, rotationOrigin: 'center'});
this.positionMarker.circle = this.map.newCircle({latlng: {lat: pos.latitude, lng: pos.longitude}, color: '#2873d8', noSelect: true, noDelete: true, noDeleteTool: true, radius: pos.accuracy, interactive: false});
let ignore = this.syncService.addMyLocation({latlng: {lat: pos.latitude, lng: pos.longitude}, label: this.name, noDeleteTool: true});
this.position = pos;
this.positionMarker.arrow = this.map.newMarker({latlng: {lat: pos.coords.latitude, lng: pos.coords.longitude}, noSelect: true, noDelete: true, noDeleteTool: true, icon: 'arrow', rotationAngle: pos.coords.heading, rotationOrigin: 'center'});
this.positionMarker.circle = this.map.newCircle({latlng: {lat: pos.coords.latitude, lng: pos.coords.longitude}, color: '#2873d8', noSelect: true, noDelete: true, noDeleteTool: true, radius: pos.coords.accuracy, interactive: false});
let ignore = this.syncService.addMyLocation({latlng: {lat: pos.coords.latitude, lng: pos.coords.longitude}, label: this.name, noDeleteTool: true});
this.position = pos.coords;
});
// Request calibration if needed