Aw4751 eslint fixes
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
@@ -8,25 +8,25 @@ export class DeviceOrientationService {
|
||||
compassHeading(alpha, beta, gamma):number {
|
||||
|
||||
// Convert degrees to radians
|
||||
var alphaRad = alpha * (Math.PI / 180);
|
||||
var betaRad = beta * (Math.PI / 180);
|
||||
var gammaRad = gamma * (Math.PI / 180);
|
||||
const alphaRad = alpha * (Math.PI / 180);
|
||||
const betaRad = beta * (Math.PI / 180);
|
||||
const gammaRad = gamma * (Math.PI / 180);
|
||||
|
||||
// Calculate equation components
|
||||
var cA = Math.cos(alphaRad);
|
||||
var sA = Math.sin(alphaRad);
|
||||
var cB = Math.cos(betaRad);
|
||||
var sB = Math.sin(betaRad);
|
||||
var cG = Math.cos(gammaRad);
|
||||
var sG = Math.sin(gammaRad);
|
||||
const cA = Math.cos(alphaRad);
|
||||
const sA = Math.sin(alphaRad);
|
||||
const cB = Math.cos(betaRad);
|
||||
const sB = Math.sin(betaRad);
|
||||
const cG = Math.cos(gammaRad);
|
||||
const sG = Math.sin(gammaRad);
|
||||
|
||||
// Calculate A, B, C rotation components
|
||||
var rA = - cA * sG - sA * sB * cG;
|
||||
var rB = - sA * sG + cA * sB * cG;
|
||||
var rC = - cB * cG;
|
||||
const rA = - cA * sG - sA * sB * cG;
|
||||
const rB = - sA * sG + cA * sB * cG;
|
||||
const rC = - cB * cG;
|
||||
|
||||
// Calculate compass heading
|
||||
var compassHeading = Math.atan(rA / rB);
|
||||
let compassHeading = Math.atan(rA / rB);
|
||||
|
||||
// Convert from half unit circle to whole unit circle
|
||||
if(rB < 0) {
|
||||
@@ -40,7 +40,7 @@ export class DeviceOrientationService {
|
||||
getCurrentCompassHeading(): Observable<number> {
|
||||
return Observable.create((observer: Observer<number>) => {
|
||||
window.addEventListener("deviceorientation", (event:DeviceOrientationEvent)=>{
|
||||
let heading = this.compassHeading(event.alpha,event.beta,event.gamma);
|
||||
const heading = this.compassHeading(event.alpha,event.beta,event.gamma);
|
||||
if(!Number.isNaN(heading)) {
|
||||
observer.next(heading);
|
||||
}
|
||||
|
Reference in New Issue
Block a user