mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Satisfy linter
This commit is contained in:
parent
ae889304c5
commit
5d4aebf301
1 changed files with 74 additions and 71 deletions
|
@ -187,18 +187,18 @@ class GdxFor {
|
||||||
let y = this.getAccelerationY();
|
let y = this.getAccelerationY();
|
||||||
let z = this.getAccelerationZ();
|
let z = this.getAccelerationZ();
|
||||||
|
|
||||||
let x_sign = 1;
|
let xSign = 1;
|
||||||
let y_sign = 1;
|
let ySign = 1;
|
||||||
let z_sign = 1;
|
let zSign = 1;
|
||||||
|
|
||||||
if (x < 0.0) {
|
if (x < 0.0) {
|
||||||
x *= -1.0; x_sign = -1;
|
x *= -1.0; xSign = -1;
|
||||||
}
|
}
|
||||||
if (y < 0.0) {
|
if (y < 0.0) {
|
||||||
y *= -1.0; y_sign = -1;
|
y *= -1.0; ySign = -1;
|
||||||
}
|
}
|
||||||
if (z < 0.0) {
|
if (z < 0.0) {
|
||||||
z *= -1.0; z_sign = -1;
|
z *= -1.0; zSign = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the yz unit vector
|
// Compute the yz unit vector
|
||||||
|
@ -220,10 +220,10 @@ class GdxFor {
|
||||||
value *= 57.2957795; // convert from rad to deg
|
value *= 57.2957795; // convert from rad to deg
|
||||||
}
|
}
|
||||||
// Manage the sign of the result
|
// Manage the sign of the result
|
||||||
let yz_sign = y_sign;
|
let yzSign = ySign;
|
||||||
if (z > y) yz_sign = z_sign;
|
if (z > y) yzSign = zSign;
|
||||||
if (yz_sign == -1) value = 180.0 - value;
|
if (yzSign === -1) value = 180.0 - value;
|
||||||
value *= x_sign;
|
value *= xSign;
|
||||||
// Round the result to the nearest degree
|
// Round the result to the nearest degree
|
||||||
value += 0.5;
|
value += 0.5;
|
||||||
return value;
|
return value;
|
||||||
|
@ -237,18 +237,18 @@ class GdxFor {
|
||||||
let y = this.getAccelerationY();
|
let y = this.getAccelerationY();
|
||||||
let z = this.getAccelerationZ();
|
let z = this.getAccelerationZ();
|
||||||
|
|
||||||
let x_sign = 1;
|
let xSign = 1;
|
||||||
let y_sign = 1;
|
let ySign = 1;
|
||||||
let z_sign = 1;
|
let zSign = 1;
|
||||||
|
|
||||||
if (x < 0.0) {
|
if (x < 0.0) {
|
||||||
x *= -1.0; x_sign = -1;
|
x *= -1.0; xSign = -1;
|
||||||
}
|
}
|
||||||
if (y < 0.0) {
|
if (y < 0.0) {
|
||||||
y *= -1.0; y_sign = -1;
|
y *= -1.0; ySign = -1;
|
||||||
}
|
}
|
||||||
if (z < 0.0) {
|
if (z < 0.0) {
|
||||||
z *= -1.0; z_sign = -1;
|
z *= -1.0; zSign = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the yz unit vector
|
// Compute the yz unit vector
|
||||||
|
@ -270,10 +270,10 @@ class GdxFor {
|
||||||
value *= 57.2957795; // convert from rad to deg
|
value *= 57.2957795; // convert from rad to deg
|
||||||
}
|
}
|
||||||
// Manage the sign of the result
|
// Manage the sign of the result
|
||||||
let xz_sign = x_sign;
|
let xzSign = xSign;
|
||||||
if (z > x) xz_sign = z_sign;
|
if (z > x) xzSign = zSign;
|
||||||
if (xz_sign == -1) value = 180.0 - value;
|
if (xzSign === -1) value = 180.0 - value;
|
||||||
value *= y_sign;
|
value *= ySign;
|
||||||
// Round the result to the nearest degree
|
// Round the result to the nearest degree
|
||||||
value += 0.5;
|
value += 0.5;
|
||||||
return value;
|
return value;
|
||||||
|
@ -428,7 +428,8 @@ class Scratch3GdxForBlocks {
|
||||||
text: formatMessage({
|
text: formatMessage({
|
||||||
id: 'gdxfor.whenAccelerationCompare',
|
id: 'gdxfor.whenAccelerationCompare',
|
||||||
default: 'when acceleration [COMPARE] [VALUE]',
|
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,
|
blockType: BlockType.HAT,
|
||||||
arguments: {
|
arguments: {
|
||||||
|
@ -448,7 +449,8 @@ class Scratch3GdxForBlocks {
|
||||||
text: formatMessage({
|
text: formatMessage({
|
||||||
id: 'gdxfor.whenSpinSpeedCompare',
|
id: 'gdxfor.whenSpinSpeedCompare',
|
||||||
default: 'when spin speed [COMPARE] [VALUE]',
|
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,
|
blockType: BlockType.HAT,
|
||||||
arguments: {
|
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.
|
* @return {number} - the magnitude of a three dimension vector.
|
||||||
*/
|
*/
|
||||||
magnitude (x, y, z) {
|
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) {
|
getTilt (args) {
|
||||||
console.log(args);
|
|
||||||
|
|
||||||
switch (args.TILT) {
|
switch (args.TILT) {
|
||||||
case 'x':
|
case 'x':
|
||||||
return this._peripheral.getTiltX();
|
return this._peripheral.getTiltX();
|
||||||
|
|
Loading…
Reference in a new issue