2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-20 07:16:03 +00:00

fhemweb_colorpicker.js: fix for rgb preset mode if widgetOverride rgb:HSV is used

git-svn-id: https://svn.fhem.de/fhem/trunk@12567 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2016-11-13 17:22:57 +00:00
parent 574308d328
commit a741be83d1

View File

@ -26,7 +26,18 @@ FW_colorpickerCreate(elName, devName, vArr, currVal, set, params, cmd)
mode = vArr[1]
//console.log( "mode: "+mode );
var cmds = []; // the 3 commands vor hue, sat, bri
//preset ?
if( params && params.length ) {
var color = params[0];
if( mode == 'CT' )
color = colorpicker_ct2rgb(color);
var newEl = $('<div informID="###" style="width:32px;height:19px;border:1px solid #fff;border-radius:8px;background-color:#'+color+'" >').get(0);
$(newEl).click(function(arg) { cmd(params[0]) });
return newEl;
}
var cmds = []; // the 3 commands für hue, sat, bri
var ranges = []; // the 3 slider ranges
var is_real_hsv = false;
if( vArr.length == 14 ) { // hsv:colorpicker,HSV,hue,0,1,360,sat,0,1,100,bri,0,1,100
@ -168,18 +179,6 @@ FW_colorpickerCreate(elName, devName, vArr, currVal, set, params, cmd)
if( mode == 'HSV' )
return createHSVSliders();
//preset ?
if( params && params.length ) {
var color = params[0];
if( mode == 'CT' )
color = colorpicker_ct2rgb(color);
var newEl = $('<div informID="###" style="width:32px;height:19px;border:1px solid #fff;border-radius:8px;background-color:#'+color+'" >').get(0);
$(newEl).click(function(arg) { cmd(params[0]) });
return newEl;
}
if( mode == 'CT' ) {
if( currVal )
currVal = currVal.match(/[\d.\-]*/)[0];