Skip to content

Commit

Permalink
Allow for multiple enable/disable targets
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisMBarr committed Jul 30, 2023
1 parent 11ffca9 commit 71d2b8b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ Array.from($$('#svg-controls .form-control-wrapper')).forEach((ctrl) => {

//Checkboxes to enable/disable other inputs
if ($enableInput) {
const $enableTgt = $(attr($enableInput, 'data-enable'));
const $enableTargets = $$(attr($enableInput, 'data-enable'));
$enableInput.addEventListener('input', () => {
$enableTgt.disabled = !$enableInput.checked;
updateTexture($enableTgt, $outputDisplay, false);
const isChecked = $enableInput.checked;
$enableTargets.forEach((t) => (t.disabled = !isChecked));

$enableTargets.forEach((t) => updateTexture(t, $outputDisplay, false));
});

//Initialize
$enableTgt.disabled = !$enableInput.checked;
$enableTargets.forEach((t) => (t.disabled = !$enableInput.checked));
}

if ($toggleVisibilityInput) {
Expand Down

0 comments on commit 71d2b8b

Please sign in to comment.