Added a ton of logging to physics service to debug mobile with
This commit is contained in:
parent
03079dc861
commit
597902ea66
@ -21,12 +21,22 @@ export class PhysicsService {
|
|||||||
permissionsService.requestPermission('geolocation', 'gps_fixed', 'Can we use your location?').then(granted => {
|
permissionsService.requestPermission('geolocation', 'gps_fixed', 'Can we use your location?').then(granted => {
|
||||||
if(granted) {
|
if(granted) {
|
||||||
// Gather physical data
|
// Gather physical data
|
||||||
window.addEventListener('deviceorientation', orientation => this.orientation.next(orientation));
|
window.addEventListener('deviceorientation', orientation => {
|
||||||
window.addEventListener('devicemotion', motion => this.motion.next(motion));
|
console.log('Orientation:', orientation);
|
||||||
navigator.geolocation.watchPosition(position => this.position.next(position));
|
this.orientation.next(orientation);
|
||||||
|
});
|
||||||
|
window.addEventListener('devicemotion', motion => {
|
||||||
|
console.log('Motion:', motion);
|
||||||
|
this.motion.next(motion);
|
||||||
|
});
|
||||||
|
navigator.geolocation.watchPosition(position => {
|
||||||
|
console.log('GPS:', position);
|
||||||
|
this.position.next(position);
|
||||||
|
});
|
||||||
|
|
||||||
// Combine data into one nice package
|
// Combine data into one nice package
|
||||||
combineLatest(this.position, this.orientation, this.calibrate).subscribe(data => {
|
combineLatest(this.position, this.orientation, this.calibrate).subscribe(data => {
|
||||||
|
console.log('Combine:', data);
|
||||||
if(!data[0]) return;
|
if(!data[0]) return;
|
||||||
|
|
||||||
let info = {
|
let info = {
|
||||||
@ -51,6 +61,7 @@ export class PhysicsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.info.next(info);
|
this.info.next(info);
|
||||||
|
console.log('Out:', info);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user