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