Add a modal for controls

This commit is contained in:
2024-02-06 22:14:53 +01:00
parent 877b162eaa
commit e2022b409d
5 changed files with 128 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ const IS_INVALID = 'is-invalid';
const wordInput = /** @type {HTMLInputElement} */ (document.getElementById('word-input'));
const buttons = /** @type {HTMLDivElement} */ (document.getElementById('input-buttons'));
const controlsButton = /** @type {HTMLButtonElement} */ (document.getElementById('controls-button'));
const clearButton = /** @type {HTMLButtonElement} */ (document.getElementById('clear-button'));
const light = /** @type {HTMLDivElement} */ (document.getElementById('light'));
@@ -19,6 +20,11 @@ export function openAutomaton(states, editable = false) {
const viewer = new GraphEditor();
viewer.readonly = !editable;
if (editable) {
controlsButton.removeAttribute('hidden');
} else {
controlsButton.setAttribute('hidden', 'hidden');
}
const graph = createGraph(states);
viewer.addEventListener('change', () => {
try {