diff options
author | Orangerot <purple@orangerot.dev> | 2024-12-10 04:33:17 +0100 |
---|---|---|
committer | Orangerot <purple@orangerot.dev> | 2024-12-10 04:33:17 +0100 |
commit | 76872c7bdec8ba2c681ebb752899f43cdd74941a (patch) | |
tree | d1dedd5976ca57794c50b0885d98eb1eb4e473b6 /main.js | |
parent | a4af4cc514ab80cd3bb221533d51db705248d8e9 (diff) |
feat: buttons to reset sliders
Diffstat (limited to 'main.js')
-rw-r--r-- | main.js | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -32,9 +32,21 @@ document.addEventListener("DOMContentLoaded", function() { for (let element of elements) { element.addEventListener("input", settings_apply); } + + const reset_elements = document.getElementsByClassName(setting + "-reset"); + for (let reset_element of reset_elements) { + reset_element.addEventListener("click", () => reset_all(setting)); + } } +}); -}) +function reset_all(setting) { + console.log("reseting " + setting); + for (let element of settings[setting].elements) { + element.value = element.defaultValue; + } + draw(true); +} function take_picture() { document.body.classList.add("editor-enabled"); |