From 8dbd25c548271a79946a431ed665fad0b01dd009 Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Tue, 10 Sep 2019 12:35:12 +0300 Subject: [PATCH] lights: initColor args --- code/html/custom.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/code/html/custom.js b/code/html/custom.js index f3717860..97f7fe06 100644 --- a/code/html/custom.js +++ b/code/html/custom.js @@ -1112,6 +1112,10 @@ function getPickerRGB(picker) { return $(picker).wheelColorPicker("getValue", "css"); } +function setPickerRGB(picker, color) { + $(picker).wheelColorPicker("setValue", value, true); +} + // TODO: use pct values instead of doing conversion? function getPickerHSV(picker) { var color = $(picker).wheelColorPicker("getColor"); @@ -1130,7 +1134,11 @@ function setPickerHSV(picker, value) { }); } -function initColor(rgb) { +function initColor(cfg) { + var rgb = false; + if (typeof cfg === "object") { + rgb = cfg.rgb; + } // check if already initialized var done = $("#colors > div").length; @@ -1462,14 +1470,13 @@ function processData(data) { if ("rgb" === key) { - initColor(true); + initColor({rgb: true}); $("input[name='color']").wheelColorPicker("setValue", value, true); return; } if ("hsv" === key) { - initColor(false); - $("#brightness").hide(); + initColor({hsv: true}); setPickerHSV(value); return; }