🧹 Formats
This commit is contained in:
@@ -71,7 +71,7 @@
|
|||||||
data[2] = toUint8($input.left.y, -1, 1);
|
data[2] = toUint8($input.left.y, -1, 1);
|
||||||
data[3] = toUint8($input.right.x, -1, 1);
|
data[3] = toUint8($input.right.x, -1, 1);
|
||||||
data[4] = toUint8($input.right.y, -1, 1);
|
data[4] = toUint8($input.right.y, -1, 1);
|
||||||
data[5] = toUint8($input.height, 0, 100);;
|
data[5] = toUint8($input.height, 0, 100);
|
||||||
data[6] = toUint8($input.speed, 0, 100);
|
data[6] = toUint8($input.speed, 0, 100);
|
||||||
|
|
||||||
outControllerData.set(data);
|
outControllerData.set(data);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export const toUint8 = (number:number, min:number, max:number) => {
|
export const toUint8 = (number: number, min: number, max: number) => {
|
||||||
number = Math.max(min, Math.min(max, number));
|
number = Math.max(min, Math.min(max, number));
|
||||||
let scaled = ((number - min) / (max - min)) * 255;
|
let scaled = ((number - min) / (max - min)) * 255;
|
||||||
return Math.round(scaled) & 0xFF;
|
return Math.round(scaled) & 0xff;
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { describe, it, expect, beforeEach, afterEach, test, vitest } from 'vites
|
|||||||
|
|
||||||
describe('throttler', () => {
|
describe('throttler', () => {
|
||||||
let throttleInstance: throttler;
|
let throttleInstance: throttler;
|
||||||
let callback
|
let callback;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vitest.useFakeTimers();
|
vitest.useFakeTimers();
|
||||||
|
|||||||
Reference in New Issue
Block a user