From c169c65c4a3cec11ffdf61132b9f42e81d184f19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=A9ng?= <99890979+maiminhdung@users.noreply.github.com> Date: Fri, 15 Aug 2025 22:13:43 +0700 Subject: [PATCH] Add missing buttion Add Enable/Disable limit speed --- Auto-Image.js | 56 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/Auto-Image.js b/Auto-Image.js index b5463d8..64546fa 100644 --- a/Auto-Image.js +++ b/Auto-Image.js @@ -197,6 +197,7 @@ fileError: "❌ Error processing file", invalidFileFormat: "❌ Invalid file format", paintingSpeed: "Painting Speed", + enableSpeedControl: "Enable Speed Control", pixelsPerSecond: "pixels/second", speedSetting: "Speed: {speed} pixels/sec", settings: "Settings", @@ -262,6 +263,7 @@ fileError: "❌ Erro ao processar arquivo", invalidFileFormat: "❌ Formato de arquivo inválido", paintingSpeed: "Velocidade de Pintura", + enableSpeedControl: "Ativar Controle de Velocidade", pixelsPerSecond: "pixels/segundo", speedSetting: "Velocidade: {speed} pixels/seg", settings: "Configurações", @@ -327,6 +329,7 @@ fileError: "❌ Lỗi khi xử lý tệp", invalidFileFormat: "❌ Định dạng tệp không hợp lệ", paintingSpeed: "Tốc độ vẽ", + enableSpeedControl: "Bật điều khiển tốc độ", pixelsPerSecond: "pixel/giây", speedSetting: "Tốc độ: {speed} pixel/giây", settings: "Cài đặt", @@ -392,6 +395,7 @@ fileError: "❌ Erreur lors du traitement du fichier", invalidFileFormat: "❌ Format de fichier invalide", paintingSpeed: "Vitesse de peinture", + enableSpeedControl: "Activer le contrôle de vitesse", pixelsPerSecond: "pixels/seconde", speedSetting: "Vitesse: {speed} pixels/sec", settings: "Paramètres", @@ -2372,11 +2376,30 @@ ${Utils.t("paintingSpeed")}
-
- - ${CONFIG.PAINTING_SPEED.DEFAULT} + +
+
+ + +
+
+ + ${CONFIG.PAINTING_SPEED.DEFAULT} +
+
+
${Utils.t("speedSettingDesc", {min: CONFIG.PAINTING_SPEED.MIN, max: CONFIG.PAINTING_SPEED.MAX})}
@@ -3542,15 +3565,24 @@ // Painting speed toggle const enableSpeedToggle = settingsContainer.querySelector("#enableSpeedToggle") + const speedControls = settingsContainer.querySelector("#speedControls") if (enableSpeedToggle) { - // Initialize speed slider disabled state - const speedSliderToggle = settingsContainer.querySelector("#speedSlider") - if (speedSliderToggle) speedSliderToggle.disabled = !CONFIG.PAINTING_SPEED_ENABLED + // Initialize visual state enableSpeedToggle.checked = CONFIG.PAINTING_SPEED_ENABLED + if (speedControls) { + speedControls.style.opacity = CONFIG.PAINTING_SPEED_ENABLED ? '1' : '0.5' + speedControls.style.pointerEvents = CONFIG.PAINTING_SPEED_ENABLED ? 'auto' : 'none' + } + enableSpeedToggle.addEventListener("change", (e) => { CONFIG.PAINTING_SPEED_ENABLED = e.target.checked - // Toggle speed slider - if (speedSliderToggle) speedSliderToggle.disabled = !CONFIG.PAINTING_SPEED_ENABLED + + // Update visual state + if (speedControls) { + speedControls.style.opacity = CONFIG.PAINTING_SPEED_ENABLED ? '1' : '0.5' + speedControls.style.pointerEvents = CONFIG.PAINTING_SPEED_ENABLED ? 'auto' : 'none' + } + // Save preference to localStorage try { localStorage.setItem("wplace-painting-speed-enabled", CONFIG.PAINTING_SPEED_ENABLED.toString()) @@ -3558,13 +3590,17 @@ console.warn("Could not save painting speed enabled preference:", error) } }) + // Load saved preference try { const savedEnabled = localStorage.getItem("wplace-painting-speed-enabled") if (savedEnabled !== null) { CONFIG.PAINTING_SPEED_ENABLED = savedEnabled === "true" enableSpeedToggle.checked = CONFIG.PAINTING_SPEED_ENABLED - if (speedSliderToggle) speedSliderToggle.disabled = !CONFIG.PAINTING_SPEED_ENABLED + if (speedControls) { + speedControls.style.opacity = CONFIG.PAINTING_SPEED_ENABLED ? '1' : '0.5' + speedControls.style.pointerEvents = CONFIG.PAINTING_SPEED_ENABLED ? 'auto' : 'none' + } } } catch (error) { console.warn("Could not load painting speed enabled preference:", error)