Satisfy linter

This commit is contained in:
Valerie Young 2019-01-09 18:02:36 -05:00
parent ae889304c5
commit 5d4aebf301

View file

@ -187,18 +187,18 @@ class GdxFor {
let y = this.getAccelerationY();
let z = this.getAccelerationZ();
let x_sign = 1;
let y_sign = 1;
let z_sign = 1;
let xSign = 1;
let ySign = 1;
let zSign = 1;
if (x < 0.0) {
x *= -1.0; x_sign = -1;
x *= -1.0; xSign = -1;
}
if (y < 0.0) {
y *= -1.0; y_sign = -1;
y *= -1.0; ySign = -1;
}
if (z < 0.0) {
z *= -1.0; z_sign = -1;
z *= -1.0; zSign = -1;
}
// Compute the yz unit vector
@ -220,10 +220,10 @@ class GdxFor {
value *= 57.2957795; // convert from rad to deg
}
// Manage the sign of the result
let yz_sign = y_sign;
if (z > y) yz_sign = z_sign;
if (yz_sign == -1) value = 180.0 - value;
value *= x_sign;
let yzSign = ySign;
if (z > y) yzSign = zSign;
if (yzSign === -1) value = 180.0 - value;
value *= xSign;
// Round the result to the nearest degree
value += 0.5;
return value;
@ -237,18 +237,18 @@ class GdxFor {
let y = this.getAccelerationY();
let z = this.getAccelerationZ();
let x_sign = 1;
let y_sign = 1;
let z_sign = 1;
let xSign = 1;
let ySign = 1;
let zSign = 1;
if (x < 0.0) {
x *= -1.0; x_sign = -1;
x *= -1.0; xSign = -1;
}
if (y < 0.0) {
y *= -1.0; y_sign = -1;
y *= -1.0; ySign = -1;
}
if (z < 0.0) {
z *= -1.0; z_sign = -1;
z *= -1.0; zSign = -1;
}
// Compute the yz unit vector
@ -270,10 +270,10 @@ class GdxFor {
value *= 57.2957795; // convert from rad to deg
}
// Manage the sign of the result
let xz_sign = x_sign;
if (z > x) xz_sign = z_sign;
if (xz_sign == -1) value = 180.0 - value;
value *= y_sign;
let xzSign = xSign;
if (z > x) xzSign = zSign;
if (xzSign === -1) value = 180.0 - value;
value *= ySign;
// Round the result to the nearest degree
value += 0.5;
return value;
@ -428,7 +428,8 @@ class Scratch3GdxForBlocks {
text: formatMessage({
id: 'gdxfor.whenAccelerationCompare',
default: 'when acceleration [COMPARE] [VALUE]',
description: 'when the meters/second^2 value measured by the acceleration sensor is compared to some value'
description: 'when the meters/second^2 value measured by the ' +
'acceleration sensor is compared to some value'
}),
blockType: BlockType.HAT,
arguments: {
@ -448,7 +449,8 @@ class Scratch3GdxForBlocks {
text: formatMessage({
id: 'gdxfor.whenSpinSpeedCompare',
default: 'when spin speed [COMPARE] [VALUE]',
description: 'when the degrees/second value measured by the gyroscope sensor is compared to some value'
description: 'when the degrees/second value measured by the ' +
'gyroscope sensor is compared to some value'
}),
blockType: BlockType.HAT,
arguments: {
@ -550,10 +552,13 @@ class Scratch3GdxForBlocks {
}
/**
* @param {number} x - x axis vector
* @param {number} y - y axis vector
* @param {number} z - z axis vector
* @return {number} - the magnitude of a three dimension vector.
*/
magnitude (x, y, z) {
return Math.sqrt(x * x + y * y + z * z);
return Math.sqrt((x * x) + (y * y) + (z * z));
}
@ -627,8 +632,6 @@ class Scratch3GdxForBlocks {
}
}
getTilt (args) {
console.log(args);
switch (args.TILT) {
case 'x':
return this._peripheral.getTiltX();