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:
co-authored by
Claude Sonnet 4.6
parent
e72312f23f
commit
6e540fdb12
@@ -205,9 +205,17 @@ Frank</textarea>
|
|||||||
function showError(msg: string) { errorEl.textContent = msg; errorEl.classList.remove('hidden'); }
|
function showError(msg: string) { errorEl.textContent = msg; errorEl.classList.remove('hidden'); }
|
||||||
function clearError() { errorEl.textContent = ''; errorEl.classList.add('hidden'); }
|
function clearError() { errorEl.textContent = ''; errorEl.classList.add('hidden'); }
|
||||||
|
|
||||||
updateBtn.addEventListener('click', () => {
|
function applyItems() {
|
||||||
const parsed = parseItems();
|
const parsed = parseItems();
|
||||||
if (parsed) { items = parsed; draw(currentRotation); }
|
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 ─────────────────────────────────────────────────────────
|
// ── Spin ─────────────────────────────────────────────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user