mirror of
https://gitlab1.ptb.de/waltem01/Matrix
synced 2024-11-14 00:43:50 +00:00
use unified implemetation of matrix parameters
This commit is contained in:
parent
7dec79ea84
commit
6fe5690a6b
@ -1,13 +1,7 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
PUBLIC_LED_CHAIN,
|
||||
PUBLIC_LED_HEIGHT,
|
||||
PUBLIC_LED_PARALLEL,
|
||||
PUBLIC_LED_WIDTH
|
||||
} from '$env/static/public';
|
||||
import { rgbToHex, type Color, getContrastColor } from '$lib/client/color';
|
||||
import { detectGamepad, gamepadButtonPress } from '$lib/client/gamepad';
|
||||
import { initializeMatrix, type Matrix } from '$lib/client/matrix';
|
||||
import { initializeMatrix, createGridArray, type Matrix } from '$lib/client/matrix';
|
||||
import { redirectAPI } from '$lib/client/httpRequests';
|
||||
import { toRadians } from '$lib/client/miscellaneous';
|
||||
import type { APIResponse } from '$lib/interfaces';
|
||||
@ -191,7 +185,7 @@
|
||||
matrix.scale.padding = 0.1875 * (192 / matrix.width) * matrix.scale.factor;
|
||||
|
||||
// Reinitialize matrix
|
||||
matrix.grid = initializeMatrix(matrix.scale.factor);
|
||||
matrix.grid = createGridArray(matrix);
|
||||
}
|
||||
|
||||
// System variables
|
||||
@ -230,15 +224,12 @@
|
||||
if (e.gamepad.id === gamepad?.id) gamepad = null;
|
||||
});
|
||||
|
||||
const scaling = 3,
|
||||
width = +PUBLIC_LED_WIDTH * +PUBLIC_LED_CHAIN,
|
||||
padding = 0.1875 * (192 / width) * scaling;
|
||||
matrix = {
|
||||
width,
|
||||
height: +PUBLIC_LED_HEIGHT * +PUBLIC_LED_PARALLEL,
|
||||
scale: { factor: scaling, padding },
|
||||
grid: initializeMatrix(scaling)
|
||||
matrix = initializeMatrix();
|
||||
matrix.scale = {
|
||||
factor: 3,
|
||||
padding: 0.1875 * (192 / width) * 3
|
||||
};
|
||||
matrix.grid = createGridArray(matrix);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -1,12 +1,6 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
PUBLIC_LED_CHAIN,
|
||||
PUBLIC_LED_HEIGHT,
|
||||
PUBLIC_LED_PARALLEL,
|
||||
PUBLIC_LED_WIDTH
|
||||
} from '$env/static/public';
|
||||
import { initializeMatrix, type Matrix } from '$lib/client/matrix';
|
||||
import { redirectAPI } from '$lib/client/httpRequests';
|
||||
import type { Matrix } from '$lib/client/matrix';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
// Data structure to keep track of clock
|
||||
@ -195,10 +189,7 @@
|
||||
|
||||
onMount(() => {
|
||||
setInterval(update, clock.speed * 1000);
|
||||
matrix = {
|
||||
width: +PUBLIC_LED_WIDTH * +PUBLIC_LED_CHAIN,
|
||||
height: +PUBLIC_LED_HEIGHT * +PUBLIC_LED_PARALLEL
|
||||
};
|
||||
matrix = initializeMatrix();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -1,12 +1,6 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
PUBLIC_LED_WIDTH,
|
||||
PUBLIC_LED_HEIGHT,
|
||||
PUBLIC_LED_CHAIN,
|
||||
PUBLIC_LED_PARALLEL
|
||||
} from '$env/static/public';
|
||||
import { initializeMatrix, type Matrix } from '$lib/client/matrix';
|
||||
import { redirectAPI } from '$lib/client/httpRequests';
|
||||
import type { Matrix } from '$lib/client/matrix';
|
||||
import type { APIResponse } from '$lib/interfaces';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
@ -178,10 +172,7 @@
|
||||
|
||||
// On client loaded
|
||||
onMount(() => {
|
||||
matrix = {
|
||||
width: +PUBLIC_LED_WIDTH * +PUBLIC_LED_CHAIN,
|
||||
height: +PUBLIC_LED_HEIGHT * +PUBLIC_LED_PARALLEL
|
||||
};
|
||||
matrix = initializeMatrix();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user