From 45c0c43f49c6367e2bebac7188ba16f037eb2d56 Mon Sep 17 00:00:00 2001 From: Vitor de Miranda Henrique Date: Fri, 12 May 2017 12:31:47 -0500 Subject: [PATCH] V 4.5 --- .../octoprint_neopixel/octoprint_neopixel.ino | 99 ++++++++ .../static/css/bootstrap-colorpicker.css | 230 ++++++++++++++++++ .../alpha-horizontal.png | Bin 0 -> 557 bytes .../img/bootstrap-colorpicker/alpha.png | Bin 0 -> 488 bytes .../bootstrap-colorpicker/hue-horizontal.png | Bin 0 -> 478 bytes .../static/img/bootstrap-colorpicker/hue.png | Bin 0 -> 504 bytes .../img/bootstrap-colorpicker/saturation.png | Bin 0 -> 4143 bytes .../static/js/bootstrap-colorpicker.min.js | 5 + octoprint_enclosure/static/js/enclosure.js | 106 +++++++- 9 files changed, 437 insertions(+), 3 deletions(-) create mode 100644 extras/octoprint_neopixel/octoprint_neopixel.ino create mode 100755 octoprint_enclosure/static/css/bootstrap-colorpicker.css create mode 100755 octoprint_enclosure/static/img/bootstrap-colorpicker/alpha-horizontal.png create mode 100755 octoprint_enclosure/static/img/bootstrap-colorpicker/alpha.png create mode 100755 octoprint_enclosure/static/img/bootstrap-colorpicker/hue-horizontal.png create mode 100755 octoprint_enclosure/static/img/bootstrap-colorpicker/hue.png create mode 100755 octoprint_enclosure/static/img/bootstrap-colorpicker/saturation.png create mode 100755 octoprint_enclosure/static/js/bootstrap-colorpicker.min.js diff --git a/extras/octoprint_neopixel/octoprint_neopixel.ino b/extras/octoprint_neopixel/octoprint_neopixel.ino new file mode 100644 index 0000000..67ecd8e --- /dev/null +++ b/extras/octoprint_neopixel/octoprint_neopixel.ino @@ -0,0 +1,99 @@ + +#include "Arduino.h" +#include "Wire.h" +#include + +//define DEBUG //Uncoment this line to get debug information of the Serial port. + +#ifdef DEBUG + #define DEBUG_PRINT(x) Serial.print (x) + #define DEBUG_PRINTDEC(x) Serial.print (x, DEC) + #define DEBUG_PRINTBIN(x) Serial.print (x, BIN) + #define DEBUG_PRINTLN(x) Serial.println (x) + #define DEBUG_WRITE(x) Serial.write (x) + #define DEBUG_WRITE_LEN(x,len) Serial.write (x,len) +#else + #define DEBUG_PRINT(x) + #define DEBUG_PRINTDEC(x) + #define DEBUG_PRINTBIN(x) + #define DEBUG_PRINTLN(x) + #define DEBUG_WRITE(x) + #define DEBUG_WRITE_LEN(x,len) +#endif + +#define LED_TYPE NEO_GRB + NEO_KHZ800 +#define I2CADDRESS 0x04 + +Adafruit_NeoPixel strip = Adafruit_NeoPixel(); + +bool gotData = false; +int command = 0; +int neopixelPin = 0; +int neopixelLeds = 0; +int neopixelBrightness = 0; +int redValue = 0; +int greenValue = 0; +int blueValue = 0; + +void receiveEvent(int byteCount){ + DEBUG_PRINT("WIRE BUFFER: "); + DEBUG_PRINTLN(Wire.available()); + DEBUG_PRINT("CMD "); + command = Wire.read(); + DEBUG_PRINTLN(command); + + DEBUG_PRINT("PIN "); + neopixelPin = Wire.read(); + DEBUG_PRINTLN(neopixelPin); + + DEBUG_PRINT("N LED "); + neopixelLeds = Wire.read(); + DEBUG_PRINTLN(neopixelLeds); + + DEBUG_PRINT("BRIGHTNESS "); + neopixelBrightness = Wire.read(); + DEBUG_PRINTLN(neopixelBrightness); + + DEBUG_PRINT("RED "); + redValue = Wire.read(); + DEBUG_PRINTLN(redValue); + + DEBUG_PRINT("GREEN "); + greenValue = Wire.read(); + DEBUG_PRINTLN(greenValue); + + DEBUG_PRINT("BLUE "); + blueValue = Wire.read(); + DEBUG_PRINTLN(blueValue); + + gotData = true; + +} + +void setup() { + + Wire.begin(I2CADDRESS); + #ifdef DEBUG + Serial.begin(115200); + while (!Serial) ; + Serial.println("Debuging..."); + #endif + Wire.onReceive(receiveEvent); +} + +void loop() { + + if(gotData){ + strip.setPin(neopixelPin); + strip.setBrightness(neopixelBrightness); + strip.updateLength(neopixelLeds); + strip.updateType(LED_TYPE); + strip.begin(); + for(uint16_t i=0; iNkl5JbD$mJ%t8>^MX+pA8q_5}cAta0DO|R@{IU5|M(GxNxgy+GBd8l;w&2Ec?5< zVo(HvFZxdJAnNTau8ZPXtKOAPtn2rp+IrX0nbY#4bkaNYzIIZLJrooctxYd|?rp8? z)cO+ap+cSA7pbEAUi(YitNzQ6mD^}>0x7Ez^ll73R_Xc-*~Q+Zpz#R`Ko|>@qj2QF zAcKncK;vstA0eL^`!E>xIk#_;8u-NduvaQXn$g$>7z4ttYmjqc8pS->gW&WGdI5U9QmYbj;6~_suM0VjVBk)9?FjGKLNzR9mK$u}% zJ?3)?fRmicTx%xVMC69^f7R;rWA8uZm)yve{K1EP8^1~E?L`XT8&R{cit@G7SGmNI zD-;bNVa)Z2Mil~Fb~9WBo8Kj@u3_#HiLFA<1-{qWmO2-=?0YdKVz6%S z2*9Wz8-&7K@4=W?VKkD82M*@cB4wmZ=tias{62*I43WQYJZEcwS<&N#Nal+GF`i11 zY=e+9d7#-KG!R}kc+3AQ$^6t@932p}V@@!QyyuhBvt_KD{nGq0=-+8wbOe^=^onsM vr1hwgCt@ro;xv+DFr+*}$b1+=kSNMOdLipIvOQ8u00000NkvXXu0mjf9#jU9 literal 0 HcmV?d00001 diff --git a/octoprint_enclosure/static/img/bootstrap-colorpicker/alpha.png b/octoprint_enclosure/static/img/bootstrap-colorpicker/alpha.png new file mode 100755 index 0000000000000000000000000000000000000000..2e53a30e73175009326fc030f00862d682ddfc45 GIT binary patch literal 488 zcmVP)B00056Nkl} zZ#=A8HwTy*Ji~Hui*DN)Xc=D2SbWU)JF^vFq?ipSE1)dQB?%2~zL;*2(|O#(oBR;O z#J!!4+zDc0I&77>T+tDIE@oI;6%kXWiptfQV#*c>2foJxnWs^#66pqri5SJi0v*Xc z_vjIT9?6}|hzFF05)=1g9#80;7y9mior*2jP95+vQ|{sWGtx)s=39zr^u6;HX^F`p zkx2{{y^wicti6Khm3Wyed%Eg2H=fbPc7D3VBcDWdj{r#qvrgUX$)#2lTEc%5bs}9E zZ`+UiVVyX}VI5jr+$k@C{pP8ABQF)*q|@k8ll1fgWY+Q?y|Zg0V9OmodqfH%3xo%V zF_0b~gfCME=jtfJ($v-Y^!<}BBQx2`+78RhRbxt$n5&{MunD^|({9#^#Hp{!+@o)R z!Ci&=u08T*r)OJ-Py8D;`eSXCiKA=ket6eR*LHXng}b_5r%ttFu8MwPi~vTbhPJwk eS?^O73H$>F-M_zn@}r;t0000ShR^6anYhsD}*2sixx#_ z;;N9)z(r=E(k3ElBO!xKg9K3|ZCX@f)afnmy=Qme_QYdH!ujj-fpFu|`s2Y~2olQ6 z2|AMd=Wf7d@urrB#gesBBwHjZbrP3WX_M>HCxbE~lQJV2S(N2p_yyDW7AJ5R`>_W* z@De7l32U$%Be)tvE2K~&QXw@GlZ2$CLwcoOp2~#0leB!5-{KN}!+D&+S2%(L*oR%% zhDnTLEkEmxDdue*zK#wJq_##5Q`F$=0GT~`-7ysSAOhUwhSHMLP5MN9R=S!a}6CtN3K7ctc(wrm-Pb|Ljm}_kZeK)QSKA literal 0 HcmV?d00001 diff --git a/octoprint_enclosure/static/img/bootstrap-colorpicker/hue.png b/octoprint_enclosure/static/img/bootstrap-colorpicker/hue.png new file mode 100755 index 0000000000000000000000000000000000000000..6f5ec2e502ae3e3e03f4725b0e868e8762d089ab GIT binary patch literal 504 zcmWlVPe_vi0L6c6Mj^~HS41FE*i8vzMTa!3jau0Ftck^RiETv4%*eh1etNgh#Z9kO+%DF(^hwQhXE(;=A}Olt({N8qK0N zXbe3;F%&_a$d3$k2-TpSsMI2>O_Yl&aZnr=K5;=@6TM_+u^<&@c2A zeL`>1OY{`=qnoG;wWCIK1notY$WDGs$^MZILnglaZfCu>$G?91_ND(cr{ke#6QRt+ zxJqh^itgTVIcMJOt{i?I4CJy~?T;TddFSW$ImQ!Le#{N~;{Hg%w%rj(^){Y+e`3H9 zTzq)u@>2EbL?Hd3spCs1l?Z0~Tf=MR2fDMV=&AFcTa(?n#hCBv@7kW#Y`U-c;y&>!CvSwpt@}Bttx69*vb-3-;Ki8A$y8r+H literal 0 HcmV?d00001 diff --git a/octoprint_enclosure/static/img/bootstrap-colorpicker/saturation.png b/octoprint_enclosure/static/img/bootstrap-colorpicker/saturation.png new file mode 100755 index 0000000000000000000000000000000000000000..170841cba2fe51c604a6ed63d9fa119dc4f7a73a GIT binary patch literal 4143 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 literal 0 HcmV?d00001 diff --git a/octoprint_enclosure/static/js/bootstrap-colorpicker.min.js b/octoprint_enclosure/static/js/bootstrap-colorpicker.min.js new file mode 100755 index 0000000..2cec749 --- /dev/null +++ b/octoprint_enclosure/static/js/bootstrap-colorpicker.min.js @@ -0,0 +1,5 @@ +/*! + * Bootstrap Colorpicker v2.5.1 + * https://itsjavi.com/bootstrap-colorpicker/ + */ +!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("jquery")):jQuery&&!jQuery.fn.colorpicker&&b(jQuery)}(this,function(a){"use strict";var b=function(c,d,e,f,g){this.fallbackValue=e?e&&"undefined"!=typeof e.h?e:this.value={h:0,s:0,b:0,a:1}:null,this.fallbackFormat=f?f:"rgba",this.hexNumberSignPrefix=g===!0,this.value=this.fallbackValue,this.origFormat=null,this.predefinedColors=d?d:{},this.colors=a.extend({},b.webColors,this.predefinedColors),c&&("undefined"!=typeof c.h?this.value=c:this.setColor(String(c))),this.value||(this.value={h:0,s:0,b:0,a:1})};b.webColors={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32",transparent:"transparent"},b.prototype={constructor:b,colors:{},predefinedColors:{},getValue:function(){return this.value},setValue:function(a){this.value=a},_sanitizeNumber:function(a){return"number"==typeof a?a:isNaN(a)||null===a||""===a||void 0===a?1:""===a?0:"undefined"!=typeof a.toLowerCase?(a.match(/^\./)&&(a="0"+a),Math.ceil(100*parseFloat(a))/100):1},isTransparent:function(a){return!(!a||!("string"==typeof a||a instanceof String))&&(a=a.toLowerCase().trim(),"transparent"===a||a.match(/#?00000000/)||a.match(/(rgba|hsla)\(0,0,0,0?\.?0\)/))},rgbaIsTransparent:function(a){return 0===a.r&&0===a.g&&0===a.b&&0===a.a},setColor:function(a){if(a=a.toLowerCase().trim()){if(this.isTransparent(a))return this.value={h:0,s:0,b:0,a:0},!0;var b=this.parse(a);b?(this.value=this.value={h:b.h,s:b.s,b:b.b,a:b.a},this.origFormat||(this.origFormat=b.format)):this.fallbackValue&&(this.value=this.fallbackValue)}return!1},setHue:function(a){this.value.h=1-a},setSaturation:function(a){this.value.s=a},setBrightness:function(a){this.value.b=1-a},setAlpha:function(a){this.value.a=Math.round(parseInt(100*(1-a),10)/100*100)/100},toRGB:function(a,b,c,d){0===arguments.length&&(a=this.value.h,b=this.value.s,c=this.value.b,d=this.value.a),a*=360;var e,f,g,h,i;return a=a%360/60,i=c*b,h=i*(1-Math.abs(a%2-1)),e=f=g=c-i,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a],{r:Math.round(255*e),g:Math.round(255*f),b:Math.round(255*g),a:d}},toHex:function(a,b,c,d){0===arguments.length&&(a=this.value.h,b=this.value.s,c=this.value.b,d=this.value.a);var e=this.toRGB(a,b,c,d);if(this.rgbaIsTransparent(e))return"transparent";var f=(this.hexNumberSignPrefix?"#":"")+((1<<24)+(parseInt(e.r)<<16)+(parseInt(e.g)<<8)+parseInt(e.b)).toString(16).slice(1);return f},toHSL:function(a,b,c,d){0===arguments.length&&(a=this.value.h,b=this.value.s,c=this.value.b,d=this.value.a);var e=a,f=(2-b)*c,g=b*c;return g/=f>0&&f<=1?f:2-f,f/=2,g>1&&(g=1),{h:isNaN(e)?0:e,s:isNaN(g)?0:g,l:isNaN(f)?0:f,a:isNaN(d)?0:d}},toAlias:function(a,b,c,d){var e,f=0===arguments.length?this.toHex():this.toHex(a,b,c,d),g="alias"===this.origFormat?f:this.toString(this.origFormat,!1);for(var h in this.colors)if(e=this.colors[h].toLowerCase().trim(),e===f||e===g)return h;return!1},RGBtoHSB:function(a,b,c,d){a/=255,b/=255,c/=255;var e,f,g,h;return g=Math.max(a,b,c),h=g-Math.min(a,b,c),e=0===h?null:g===a?(b-c)/h:g===b?(c-a)/h+2:(a-b)/h+4,e=(e+360)%6*60/360,f=0===h?0:h/g,{h:this._sanitizeNumber(e),s:f,b:g,a:this._sanitizeNumber(d)}},HueToRGB:function(a,b,c){return c<0?c+=1:c>1&&(c-=1),6*c<1?a+(b-a)*c*6:2*c<1?b:3*c<2?a+(b-a)*(2/3-c)*6:a},HSLtoRGB:function(a,b,c,d){b<0&&(b=0);var e;e=c<=.5?c*(1+b):c+b-c*b;var f=2*c-e,g=a+1/3,h=a,i=a-1/3,j=Math.round(255*this.HueToRGB(f,e,g)),k=Math.round(255*this.HueToRGB(f,e,h)),l=Math.round(255*this.HueToRGB(f,e,i));return[j,k,l,this._sanitizeNumber(d)]},parse:function(b){if(0===arguments.length)return!1;var c,d,e=this,f=!1,g="undefined"!=typeof this.colors[b];return g&&(b=this.colors[b].toLowerCase().trim()),a.each(this.stringParsers,function(a,h){var i=h.re.exec(b);return c=i&&h.parse.apply(e,[i]),!c||(f={},d=g?"alias":h.format?h.format:e.getValidFallbackFormat(),f=d.match(/hsla?/)?e.RGBtoHSB.apply(e,e.HSLtoRGB.apply(e,c)):e.RGBtoHSB.apply(e,c),f instanceof Object&&(f.format=d),!1)}),f},getValidFallbackFormat:function(){var a=["rgba","rgb","hex","hsla","hsl"];return this.origFormat&&a.indexOf(this.origFormat)!==-1?this.origFormat:this.fallbackFormat&&a.indexOf(this.fallbackFormat)!==-1?this.fallbackFormat:"rgba"},toString:function(a,c){a=a||this.origFormat||this.fallbackFormat,c=c||!1;var d=!1;switch(a){case"rgb":return d=this.toRGB(),this.rgbaIsTransparent(d)?"transparent":"rgb("+d.r+","+d.g+","+d.b+")";case"rgba":return d=this.toRGB(),"rgba("+d.r+","+d.g+","+d.b+","+d.a+")";case"hsl":return d=this.toHSL(),"hsl("+Math.round(360*d.h)+","+Math.round(100*d.s)+"%,"+Math.round(100*d.l)+"%)";case"hsla":return d=this.toHSL(),"hsla("+Math.round(360*d.h)+","+Math.round(100*d.s)+"%,"+Math.round(100*d.l)+"%,"+d.a+")";case"hex":return this.toHex();case"alias":return d=this.toAlias(),d===!1?this.toString(this.getValidFallbackFormat()):c&&!(d in b.webColors)&&d in this.predefinedColors?this.predefinedColors[d]:d;default:return d}},stringParsers:[{re:/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*?\)/,format:"rgb",parse:function(a){return[a[1],a[2],a[3],1]}},{re:/rgb\(\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*?\)/,format:"rgb",parse:function(a){return[2.55*a[1],2.55*a[2],2.55*a[3],1]}},{re:/rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/,format:"rgba",parse:function(a){return[a[1],a[2],a[3],a[4]]}},{re:/rgba\(\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/,format:"rgba",parse:function(a){return[2.55*a[1],2.55*a[2],2.55*a[3],a[4]]}},{re:/hsl\(\s*(\d*(?:\.\d+)?)\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*?\)/,format:"hsl",parse:function(a){return[a[1]/360,a[2]/100,a[3]/100,a[4]]}},{re:/hsla\(\s*(\d*(?:\.\d+)?)\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/,format:"hsla",parse:function(a){return[a[1]/360,a[2]/100,a[3]/100,a[4]]}},{re:/#?([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/,format:"hex",parse:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16),1]}},{re:/#?([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/,format:"hex",parse:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16),1]}}],colorNameToHex:function(a){return"undefined"!=typeof this.colors[a.toLowerCase()]&&this.colors[a.toLowerCase()]}};var c={horizontal:!1,inline:!1,color:!1,format:!1,input:"input",container:!1,component:".add-on, .input-group-addon",fallbackColor:!1,fallbackFormat:"hex",hexNumberSignPrefix:!0,sliders:{saturation:{maxLeft:100,maxTop:100,callLeft:"setSaturation",callTop:"setBrightness"},hue:{maxLeft:0,maxTop:100,callLeft:!1,callTop:"setHue"},alpha:{maxLeft:0,maxTop:100,callLeft:!1,callTop:"setAlpha"}},slidersHorz:{saturation:{maxLeft:100,maxTop:100,callLeft:"setSaturation",callTop:"setBrightness"},hue:{maxLeft:100,maxTop:0,callLeft:"setHue",callTop:!1},alpha:{maxLeft:100,maxTop:0,callLeft:"setAlpha",callTop:!1}},template:'