feat: wheel auto-updates on textarea input with 300ms debounce

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
emil
2026-05-09 16:08:41 +03:00
co-authored by Claude Sonnet 4.6
parent e72312f23f
commit 6e540fdb12
+9 -1
View File
@@ -205,9 +205,17 @@ Frank</textarea>
function showError(msg: string) { errorEl.textContent = msg; errorEl.classList.remove('hidden'); }
function clearError() { errorEl.textContent = ''; errorEl.classList.add('hidden'); }
updateBtn.addEventListener('click', () => {
function applyItems() {
const parsed = parseItems();
if (parsed) { items = parsed; draw(currentRotation); }
}
updateBtn.addEventListener('click', applyItems);
let debounceTimer: ReturnType<typeof setTimeout> | null = null;
textarea.addEventListener('input', () => {
if (debounceTimer) clearTimeout(debounceTimer);
debounceTimer = setTimeout(applyItems, 300);
});
// ── Spin ─────────────────────────────────────────────────────────