Skip to content

Commit

Permalink
Wfnews 1515 (#1165)
Browse files Browse the repository at this point in the history
* another approach on detect device magnometer

* revert compass availablity check

* compass supposed to be undefined without motion detector
  • Loading branch information
yzlucas authored Oct 11, 2023
1 parent 55bad5a commit fe4fb45
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,8 @@ initialize (data: any, index: number, reportOfFire: ReportOfFire) {
}

ngOnInit(): void {
// if ('AbsoluteOrientationSensor' in window && 'ontouchstart' in window) {
// // setup real compass thing
this.getOrientation();
this.useMyCurrentLocation();
// } else {
// // skip compass
// this.skip()
// }
}

async getOrientation() {
Expand Down Expand Up @@ -86,6 +80,10 @@ async getOrientation() {

handler(e, self) {
if (self.reportOfFire?.headingDetectionActive){
if (!e.alpha && !e.webkitCompassHeading){
this.skip()
}

try {
let compassHeading = e.webkitCompassHeading || Math.abs(e.alpha - 360);
compassHeading = Math.trunc(compassHeading)
Expand Down

0 comments on commit fe4fb45

Please sign in to comment.