From 6a47b3b06a557e0546d433ec6492fe43d740ceb7 Mon Sep 17 00:00:00 2001 From: CPTN Cosmo Date: Fri, 19 Dec 2025 02:01:12 +0100 Subject: [PATCH] fix: Ensure scale reset button correctly updates both number and range inputs. --- scripts/module.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/module.js b/scripts/module.js index 872fbf9..d1986ec 100644 --- a/scripts/module.js +++ b/scripts/module.js @@ -200,14 +200,17 @@ Hooks.on('renderSettingsConfig', (app, html, data) => { const resetBtn = $(``); resetBtn.on('click', () => { - // Crucial: Update the target input (number or range) and trigger change - targetInput.val(1.0).trigger('change'); - - // If we are targeting the number input, manually update the range input too if it exists - if (input.length && input[0] !== targetInput[0]) { - input.val(1.0); + // 1. Update Number Input (if exists) - this is usually the one with the name attribute + if (numberInput.length) { + numberInput.val(1.0).trigger('change'); } + // 2. Update Range Input - this triggers the visual slider movement + if (input.length) { + input.val(1.0).trigger('input').trigger('change'); + } + + // 3. Manually update the text display just in case if (rangeValue.length) rangeValue.text("1.0"); });