Browse Source

lights: initColor args

master
Max Prokhorov 5 years ago
parent
commit
8dbd25c548
1 changed files with 11 additions and 4 deletions
  1. +11
    -4
      code/html/custom.js

+ 11
- 4
code/html/custom.js View File

@ -1112,6 +1112,10 @@ function getPickerRGB(picker) {
return $(picker).wheelColorPicker("getValue", "css"); return $(picker).wheelColorPicker("getValue", "css");
} }
function setPickerRGB(picker, color) {
$(picker).wheelColorPicker("setValue", value, true);
}
// TODO: use pct values instead of doing conversion? // TODO: use pct values instead of doing conversion?
function getPickerHSV(picker) { function getPickerHSV(picker) {
var color = $(picker).wheelColorPicker("getColor"); 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 // check if already initialized
var done = $("#colors > div").length; var done = $("#colors > div").length;
@ -1462,14 +1470,13 @@ function processData(data) {
<!-- removeIf(!light)--> <!-- removeIf(!light)-->
if ("rgb" === key) { if ("rgb" === key) {
initColor(true);
initColor({rgb: true});
$("input[name='color']").wheelColorPicker("setValue", value, true); $("input[name='color']").wheelColorPicker("setValue", value, true);
return; return;
} }
if ("hsv" === key) { if ("hsv" === key) {
initColor(false);
$("#brightness").hide();
initColor({hsv: true});
setPickerHSV(value); setPickerHSV(value);
return; return;
} }


Loading…
Cancel
Save