From b96178b9bd2e751e5fa7e8ffbc329abcb41e5b0f Mon Sep 17 00:00:00 2001 From: Wouter Gritter Date: Thu, 21 Nov 2024 11:45:03 +0100 Subject: [PATCH 1/2] Intermediate color updates while moving around the color wheel --- wled00/data/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wled00/data/index.js b/wled00/data/index.js index d9c64bdfbf..720f3710e3 100644 --- a/wled00/data/index.js +++ b/wled00/data/index.js @@ -26,6 +26,7 @@ var pmt = 1, pmtLS = 0, pmtLast = 0; var lastinfo = {}; var isM = false, mw = 0, mh=0; var ws, wsRpt=0; +var lastIntermediateColorUpdate = new Date(); var cfg = { theme:{base:"dark", bg:{url:"", rnd: false, rndGrayscale: false, rndBlur: false}, alpha:{bg:0.6,tab:0.8}, color:{bg:""}}, comp :{colors:{picker: true, rgb: false, quick: true, hex: false}, @@ -275,6 +276,7 @@ function onLoad() handleLocationHash(); cpick.on("input:end", () => {setColor(1);}); cpick.on("color:change", () => {updatePSliders()}); + cpick.on("color:change", () => {updateIntermediateColor(); pmtLS = localStorage.getItem('wledPmt'); // Load initial data @@ -2592,6 +2594,14 @@ function updatePSliders() { gId('sliderK').value = cpick.color.kelvin; } +function updateIntermediateColor() { + const now = new Date(); + if (now - lastIntermediateColorUpdate > 500) { + lastIntermediateColorUpdate = now; + setColor(1); + } +} + function hexEnter() { if(event.keyCode == 13) fromHex(); From 73b9ca1e5036b0e90f3928f9e789254e9ea9e734 Mon Sep 17 00:00:00 2001 From: Wouter Gritter Date: Thu, 21 Nov 2024 11:52:24 +0100 Subject: [PATCH 2/2] Fix syntax --- wled00/data/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/data/index.js b/wled00/data/index.js index 720f3710e3..41801b995d 100644 --- a/wled00/data/index.js +++ b/wled00/data/index.js @@ -276,7 +276,7 @@ function onLoad() handleLocationHash(); cpick.on("input:end", () => {setColor(1);}); cpick.on("color:change", () => {updatePSliders()}); - cpick.on("color:change", () => {updateIntermediateColor(); + cpick.on("color:change", () => {updateIntermediateColor()}); pmtLS = localStorage.getItem('wledPmt'); // Load initial data