From a3e54d5f092850fcab568bf6de39dcb9b324b07b Mon Sep 17 00:00:00 2001 From: waltem01 Date: Sun, 7 Aug 2022 19:24:53 +0200 Subject: [PATCH] commented matrix.ts file --- Webserver/src/lib/client/matrix.ts | 10 ++++++---- Webserver/src/routes/admin/+page.svelte | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Webserver/src/lib/client/matrix.ts b/Webserver/src/lib/client/matrix.ts index 154ef3d..8914ce5 100644 --- a/Webserver/src/lib/client/matrix.ts +++ b/Webserver/src/lib/client/matrix.ts @@ -1,14 +1,16 @@ +// Interface to represent a singualr matrix cell object export interface MatrixCell { - xIndex: number; - yIndex: number; + x: number; + y: number; color: string; } +// Create a 2D array containing MatrixCell objects with bg-color: black export function initializeMatrix(scaling: number): MatrixCell[][] { - return Array.from({ length: 192 / scaling }, (_, yIndex) => + return Array.from({ length: 192 / scaling }, (_, y) => Array.from( { length: 192 / scaling }, - (_, xIndex) => ({ xIndex, yIndex, color: '000000' }) as MatrixCell + (_, x) => ({ x, y, color: '000000' }) as MatrixCell ) ) as MatrixCell[][]; } diff --git a/Webserver/src/routes/admin/+page.svelte b/Webserver/src/routes/admin/+page.svelte index 5396ccc..b77507d 100644 --- a/Webserver/src/routes/admin/+page.svelte +++ b/Webserver/src/routes/admin/+page.svelte @@ -579,12 +579,12 @@ on:mouseup|preventDefault={() => (mousePressed = false)} > {#each matrix as row} - + {#each row as cell}