chore(control): Keyboard queue (#31)

Co-authored-by: 2mal3 <56305732+2mal3@users.noreply.github.com>
This commit is contained in:
E44
2026-01-19 16:28:24 -05:00
committed by GitHub
parent f2a648b429
commit 3a30aca1dc
4 changed files with 28 additions and 13 deletions
@@ -34,6 +34,7 @@
import { db } from '$lib/ts/database';
import { liveQuery, type Observable } from 'dexie';
import TextInput from '$lib/components/TextInput.svelte';
import { add_to_keyboard_queue } from '$lib/ts/utils';
let all_display_states: Observable<'on' | 'off' | 'mixed'> | undefined = $state();
$effect(() => {
@@ -206,11 +207,11 @@
? 'text-stone-500 cursor-not-allowed'
: 'hover:bg-stone-600 active:bg-stone-500 cursor-pointer'} py-2 rounded-xl flex justify-center items-center transition-colors duration-200"
disabled={$selected_display_ids.length === 0}
onmousedown={async () => {
await send_single_key_press('ArrowLeft', 'press');
onmousedown={() => {
add_to_keyboard_queue(async () => await send_single_key_press('ArrowLeft', 'press'));
}}
onmouseup={async () => {
await send_single_key_press('ArrowLeft', 'release');
onmouseup={() => {
add_to_keyboard_queue(async () => await send_single_key_press('ArrowLeft', 'release'));
}}
>
<ArrowBigLeft />
@@ -222,11 +223,11 @@
? 'text-stone-500 cursor-not-allowed'
: 'hover:bg-stone-600 active:bg-stone-500 cursor-pointer'} py-2 rounded-xl flex justify-center items-center transition-colors duration-200"
disabled={$selected_display_ids.length === 0}
onmousedown={async () => {
await send_single_key_press('ArrowRight', 'press');
onmousedown={() => {
add_to_keyboard_queue(async () => await send_single_key_press('ArrowRight', 'press'));
}}
onmouseup={async () => {
await send_single_key_press('ArrowRight', 'release');
onmouseup={() => {
add_to_keyboard_queue(async () => await send_single_key_press('ArrowRight', 'release'));
}}
>
<ArrowBigRight />