From 76872c7bdec8ba2c681ebb752899f43cdd74941a Mon Sep 17 00:00:00 2001 From: Orangerot Date: Tue, 10 Dec 2024 04:33:17 +0100 Subject: feat: buttons to reset sliders --- main.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'main.js') diff --git a/main.js b/main.js index a3617e1..0960448 100644 --- a/main.js +++ b/main.js @@ -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"); -- cgit v1.2.3