From 9c4608cd5fa937b21df2098e05b853ea2ef5deb3 Mon Sep 17 00:00:00 2001 From: mike Date: Sat, 25 Jun 2016 16:11:47 -0400 Subject: [PATCH] fix hasOwnProperty Some items, like html elements, could cause an error in the hasOwnProperty function. --- build/dat.gui.js | 8 ++- build/dat.gui.min.js | 150 ++++++++++++++++++++-------------------- src/dat/utils/common.js | 8 ++- 3 files changed, 89 insertions(+), 77 deletions(-) diff --git a/build/dat.gui.js b/build/dat.gui.js index 0be0ef8..26a7668 100644 --- a/build/dat.gui.js +++ b/build/dat.gui.js @@ -175,8 +175,14 @@ dat.utils.common = (function () { hasOwnProperty: function (obj, prop) { var proto = obj.__proto__ || obj.constructor.prototype; + var proto_prop = undefined; + try { + proto_prop = proto[prop]; + } catch (err) { + console.warn('property "' + prop + '" is unaccessible in prototype of object', obj); + } return (prop in obj) && - (!(prop in proto) || (proto[prop] !== obj[prop])); + (!(prop in proto) || (proto_prop !== obj[prop])); } }; diff --git a/build/dat.gui.min.js b/build/dat.gui.min.js index db553a9..a9a385d 100644 --- a/build/dat.gui.min.js +++ b/build/dat.gui.min.js @@ -10,88 +10,88 @@ * * http://www.apache.org/licenses/LICENSE-2.0 */ -var dat=dat||{};dat.gui=dat.gui||{};dat.utils=dat.utils||{};dat.controllers=dat.controllers||{};dat.dom=dat.dom||{};dat.color=dat.color||{};dat.utils.css=function(){return{load:function(d,a){a=a||document;var c=a.createElement("link");c.type="text/css";c.rel="stylesheet";c.href=d;a.getElementsByTagName("head")[0].appendChild(c)},inject:function(d,a){a=a||document;var c=document.createElement("style");c.type="text/css";c.innerHTML=d;a.getElementsByTagName("head")[0].appendChild(c)}}}(); -dat.utils.common=function(){var d=Array.prototype.forEach,a=Array.prototype.slice;return{BREAK:{},extend:function(c){this.each(a.call(arguments,1),function(a){for(var f in a)this.isUndefined(a[f])||(c[f]=a[f])},this);return c},defaults:function(c){this.each(a.call(arguments,1),function(a){for(var f in a)this.isUndefined(c[f])&&(c[f]=a[f])},this);return c},compose:function(){var c=a.call(arguments);return function(){for(var b=a.call(arguments),f=c.length-1;0<=f;f--)b=[c[f].apply(this,b)];return b[0]}}, -each:function(a,b,f){if(a)if(d&&a.forEach&&a.forEach===d)a.forEach(b,f);else if(a.length===a.length+0)for(var e=0,r=a.length;ethis.__max&&(a=this.__max);void 0!==this.__step&&0!=a%this.__step&&(a=Math.round(a/this.__step)*this.__step);return b.superclass.prototype.setValue.call(this,a)},min:function(a){this.__min=a;return this},max:function(a){this.__max=a;return this},step:function(a){this.__impliedStep=this.__step=a;this.__precision=c(a);return this}});return b}(dat.controllers.Controller,dat.utils.common); -dat.controllers.NumberControllerBox=function(d,a,c){var b=function(f,e,d){function l(){var a=parseFloat(n.__input.value);c.isNaN(a)||n.setValue(a)}function k(a){var e=v-a.clientY;n.setValue(n.getValue()+e*n.__impliedStep);v=a.clientY}function q(){a.unbind(window,"mousemove",k);a.unbind(window,"mouseup",q)}this.__truncationSuspended=!1;b.superclass.call(this,f,e,d);var n=this,v;this.__input=document.createElement("input");this.__input.setAttribute("type","text");a.bind(this.__input,"change",l);a.bind(this.__input, -"blur",function(){l();n.__onFinishChange&&n.__onFinishChange.call(n,n.getValue())});a.bind(this.__input,"mousedown",function(e){a.bind(window,"mousemove",k);a.bind(window,"mouseup",q);v=e.clientY});a.bind(this.__input,"keydown",function(a){13===a.keyCode&&(n.__truncationSuspended=!0,this.blur(),n.__truncationSuspended=!1)});this.updateDisplay();this.domElement.appendChild(this.__input)};b.superclass=d;c.extend(b.prototype,d.prototype,{updateDisplay:function(){if(!a.isActive(this.__input)){var c=this.__input, -e;if(this.__truncationSuspended)e=this.getValue();else{e=this.getValue();var d=Math.pow(10,this.__precision);e=Math.round(e*d)/d}c.value=e}return b.superclass.prototype.updateDisplay.call(this)}});return b}(dat.controllers.NumberController,dat.dom.dom,dat.utils.common); -dat.controllers.NumberControllerSlider=function(d,a,c,b,f){function e(a,e,b,c,f){return c+(a-e)/(b-e)*(f-c)}var r=function(b,c,f,d,v){function u(b){b.preventDefault();var c=a.getOffset(g.__background),f=a.getWidth(g.__background);g.setValue(e(b.clientX,c.left,c.left+f,g.__min,g.__max));return!1}function x(){a.unbind(window,"mousemove",u);a.unbind(window,"mouseup",x);g.__onFinishChange&&g.__onFinishChange.call(g,g.getValue())}r.superclass.call(this,b,c,{min:f,max:d,step:v});var g=this;this.__background= -document.createElement("div");this.__foreground=document.createElement("div");a.bind(this.__background,"mousedown",function(e){a.bind(window,"mousemove",u);a.bind(window,"mouseup",x);u(e)});a.addClass(this.__background,"slider");a.addClass(this.__foreground,"slider-fg");this.updateDisplay();this.__background.appendChild(this.__foreground);this.domElement.appendChild(this.__background)};r.superclass=d;r.useDefaultStyles=function(){c.inject(f)};b.extend(r.prototype,d.prototype,{updateDisplay:function(){var a= -(this.getValue()-this.__min)/(this.__max-this.__min);this.__foreground.style.width=100*a+"%";return r.superclass.prototype.updateDisplay.call(this)}});return r}(dat.controllers.NumberController,dat.dom.dom,dat.utils.css,dat.utils.common,"/**\n * dat-gui JavaScript Controller Library\n * http://code.google.com/p/dat-gui\n *\n * Copyright 2011 Data Arts Team, Google Creative Lab\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n */\n\n.slider {\n box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);\n height: 1em;\n border-radius: 1em;\n background-color: #eee;\n padding: 0 0.5em;\n overflow: hidden;\n}\n\n.slider-fg {\n padding: 1px 0 2px 0;\n background-color: #aaa;\n height: 1em;\n margin-left: -0.5em;\n padding-right: 0.5em;\n border-radius: 1em 0 0 1em;\n}\n\n.slider-fg:after {\n display: inline-block;\n border-radius: 1em;\n background-color: #fff;\n border: 1px solid #aaa;\n content: '';\n float: right;\n margin-right: -1em;\n margin-top: -1px;\n height: 0.9em;\n width: 0.9em;\n}\n"); -dat.controllers.FunctionController=function(d,a,c){var b=function(c,e,d){b.superclass.call(this,c,e);var l=this;this.__button=document.createElement("div");this.__button.innerHTML=void 0===d?"Fire":d;a.bind(this.__button,"click",function(a){a.preventDefault();l.fire();return!1});a.addClass(this.__button,"button");this.domElement.appendChild(this.__button)};b.superclass=d;c.extend(b.prototype,d.prototype,{fire:function(){this.__onChange&&this.__onChange.call(this);this.getValue().call(this.object); -this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}});return b}(dat.controllers.Controller,dat.dom.dom,dat.utils.common); -dat.controllers.BooleanController=function(d,a,c){var b=function(c,e){b.superclass.call(this,c,e);var d=this;this.__prev=this.getValue();this.__checkbox=document.createElement("input");this.__checkbox.setAttribute("type","checkbox");a.bind(this.__checkbox,"change",function(){d.setValue(!d.__prev)},!1);this.domElement.appendChild(this.__checkbox);this.updateDisplay()};b.superclass=d;c.extend(b.prototype,d.prototype,{setValue:function(a){a=b.superclass.prototype.setValue.call(this,a);this.__onFinishChange&& -this.__onFinishChange.call(this,this.getValue());this.__prev=this.getValue();return a},updateDisplay:function(){!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0):this.__checkbox.checked=!1;return b.superclass.prototype.updateDisplay.call(this)}});return b}(dat.controllers.Controller,dat.dom.dom,dat.utils.common); -dat.controllers.UndefinedController=function(d,a,c){var b=function(a,e){b.superclass.call(this,a,e);this.__input=document.createElement("input");this.__input.setAttribute("type","text");this.__input.setAttribute("disabled",!0);this.domElement.appendChild(this.__input)};b.superclass=d;c.extend(b.prototype,d.prototype,{updateDisplay:function(){this.__onFinishChange&&(c.isUndefined(this.object[this.property])||this.__onFinishChange.call(this.object[this.property]));return b.superclass.prototype.updateDisplay.call(this)}}); -return b}(dat.controllers.Controller,dat.dom.dom,dat.utils.common);dat.color.toString=function(d){return function(a){if(1==a.a||d.isUndefined(a.a)){for(a=a.hex.toString(16);6>a.length;)a="0"+a;return"#"+a}return"rgba("+Math.round(a.r)+","+Math.round(a.g)+","+Math.round(a.b)+","+a.a+")"}}(dat.utils.common); -dat.color.interpret=function(d,a){var c,b,f=[{litmus:a.isString,conversions:{THREE_CHAR_HEX:{read:function(a){a=a.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null===a?!1:{space:"HEX",hex:parseInt("0x"+a[1].toString()+a[1].toString()+a[2].toString()+a[2].toString()+a[3].toString()+a[3].toString())}},write:d},SIX_CHAR_HEX:{read:function(a){a=a.match(/^#([A-F0-9]{6})$/i);return null===a?!1:{space:"HEX",hex:parseInt("0x"+a[1].toString())}},write:d},CSS_RGB:{read:function(a){a=a.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/); -return null===a?!1:{space:"RGB",r:parseFloat(a[1]),g:parseFloat(a[2]),b:parseFloat(a[3])}},write:d},CSS_RGBA:{read:function(a){a=a.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\,\s*(.+)\s*\)/);return null===a?!1:{space:"RGB",r:parseFloat(a[1]),g:parseFloat(a[2]),b:parseFloat(a[3]),a:parseFloat(a[4])}},write:d}}},{litmus:a.isNumber,conversions:{HEX:{read:function(a){return{space:"HEX",hex:a,conversionName:"HEX"}},write:function(a){return a.hex}}}},{litmus:a.isArray,conversions:{RGB_ARRAY:{read:function(a){return 3!= +dat.dom.dom=function(f){function a(b){if("0"===b||f.isUndefined(b))return 0;b=b.match(c);return f.isNull(b)?0:parseFloat(b[1])}var e={};f.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},function(b,a){f.each(b,function(b){e[b]=a})});var c=/(\d+(\.\d+)?)px/,d={makeSelectable:function(b,a){void 0!==b&&void 0!==b.style&&(b.onselectstart=a?function(){return!1}:function(){},b.style.MozUserSelect=a?"auto":"none",b.style.KhtmlUserSelect= +a?"auto":"none",b.unselectable=a?"on":"off")},makeFullscreen:function(b,a,d){f.isUndefined(a)&&(a=!0);f.isUndefined(d)&&(d=!0);b.style.position="absolute";a&&(b.style.left=0,b.style.right=0);d&&(b.style.top=0,b.style.bottom=0)},fakeEvent:function(b,a,d,c){d=d||{};var q=e[a];if(!q)throw Error("Event type "+a+" not supported.");var m=document.createEvent(q);switch(q){case "MouseEvents":m.initMouseEvent(a,d.bubbles||!1,d.cancelable||!0,window,d.clickCount||1,0,0,d.x||d.clientX||0,d.y||d.clientY||0,!1, +!1,!1,!1,0,null);break;case "KeyboardEvents":q=m.initKeyboardEvent||m.initKeyEvent;f.defaults(d,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0});q(a,d.bubbles||!1,d.cancelable,window,d.ctrlKey,d.altKey,d.shiftKey,d.metaKey,d.keyCode,d.charCode);break;default:m.initEvent(a,d.bubbles||!1,d.cancelable||!0)}f.defaults(m,c);b.dispatchEvent(m)},bind:function(a,c,e,f){a.addEventListener?a.addEventListener(c,e,f||!1):a.attachEvent&&a.attachEvent("on"+c,e);return d}, +unbind:function(a,c,e,f){a.removeEventListener?a.removeEventListener(c,e,f||!1):a.detachEvent&&a.detachEvent("on"+c,e);return d},addClass:function(a,c){if(void 0===a.className)a.className=c;else if(a.className!==c){var e=a.className.split(/ +/);-1==e.indexOf(c)&&(e.push(c),a.className=e.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return d},removeClass:function(a,c){if(c){if(void 0!==a.className)if(a.className===c)a.removeAttribute("class");else{var e=a.className.split(/ +/),f=e.indexOf(c);-1!= +f&&(e.splice(f,1),a.className=e.join(" "))}}else a.className=void 0;return d},hasClass:function(a,d){return(new RegExp("(?:^|\\s+)"+d+"(?:\\s+|$)")).test(a.className)||!1},getWidth:function(b){b=getComputedStyle(b);return a(b["border-left-width"])+a(b["border-right-width"])+a(b["padding-left"])+a(b["padding-right"])+a(b.width)},getHeight:function(b){b=getComputedStyle(b);return a(b["border-top-width"])+a(b["border-bottom-width"])+a(b["padding-top"])+a(b["padding-bottom"])+a(b.height)},getOffset:function(a){var d= +{left:0,top:0};if(a.offsetParent){do d.left+=a.offsetLeft,d.top+=a.offsetTop;while(a=a.offsetParent)}return d},isActive:function(a){return a===document.activeElement&&(a.type||a.href)}};return d}(dat.utils.common); +dat.controllers.OptionController=function(f,a,e){var c=function(d,b,f){c.superclass.call(this,d,b);var n=this;this.__select=document.createElement("select");if(e.isArray(f)){var k={};e.each(f,function(a){k[a]=a});f=k}e.each(f,function(a,b){var d=document.createElement("option");d.innerHTML=b;d.setAttribute("value",a);n.__select.appendChild(d)});this.updateDisplay();a.bind(this.__select,"change",function(){n.setValue(this.options[this.selectedIndex].value)});this.domElement.appendChild(this.__select)}; +c.superclass=f;e.extend(c.prototype,f.prototype,{setValue:function(a){a=c.superclass.prototype.setValue.call(this,a);this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue());return a},updateDisplay:function(){this.__select.value=this.getValue();return c.superclass.prototype.updateDisplay.call(this)}});return c}(dat.controllers.Controller,dat.dom.dom,dat.utils.common); +dat.controllers.NumberController=function(f,a){function e(a){a=a.toString();return-1this.__max&&(a=this.__max);void 0!==this.__step&&0!=a%this.__step&&(a=Math.round(a/this.__step)*this.__step);return c.superclass.prototype.setValue.call(this,a)},min:function(a){this.__min=a;return this},max:function(a){this.__max=a;return this},step:function(a){this.__impliedStep=this.__step=a;this.__precision=e(a);return this}});return c}(dat.controllers.Controller,dat.utils.common); +dat.controllers.NumberControllerBox=function(f,a,e){var c=function(d,b,f){function n(){var a=parseFloat(m.__input.value);e.isNaN(a)||m.setValue(a)}function k(a){var b=v-a.clientY;m.setValue(m.getValue()+b*m.__impliedStep);v=a.clientY}function q(){a.unbind(window,"mousemove",k);a.unbind(window,"mouseup",q)}this.__truncationSuspended=!1;c.superclass.call(this,d,b,f);var m=this,v;this.__input=document.createElement("input");this.__input.setAttribute("type","text");a.bind(this.__input,"change",n);a.bind(this.__input, +"blur",function(){n();m.__onFinishChange&&m.__onFinishChange.call(m,m.getValue())});a.bind(this.__input,"mousedown",function(b){a.bind(window,"mousemove",k);a.bind(window,"mouseup",q);v=b.clientY});a.bind(this.__input,"keydown",function(a){13===a.keyCode&&(m.__truncationSuspended=!0,this.blur(),m.__truncationSuspended=!1)});this.updateDisplay();this.domElement.appendChild(this.__input)};c.superclass=f;e.extend(c.prototype,f.prototype,{updateDisplay:function(){if(!a.isActive(this.__input)){var d=this.__input, +b;if(this.__truncationSuspended)b=this.getValue();else{b=this.getValue();var e=Math.pow(10,this.__precision);b=Math.round(b*e)/e}d.value=b}return c.superclass.prototype.updateDisplay.call(this)}});return c}(dat.controllers.NumberController,dat.dom.dom,dat.utils.common); +dat.controllers.NumberControllerSlider=function(f,a,e,c,d){function b(a,b,c,d,e){return d+(a-b)/(c-b)*(e-d)}var t=function(c,d,e,f,v){function u(c){c.preventDefault();var d=a.getOffset(g.__background),e=a.getWidth(g.__background);g.setValue(b(c.clientX,d.left,d.left+e,g.__min,g.__max));return!1}function x(){a.unbind(window,"mousemove",u);a.unbind(window,"mouseup",x);g.__onFinishChange&&g.__onFinishChange.call(g,g.getValue())}t.superclass.call(this,c,d,{min:e,max:f,step:v});var g=this;this.__background= +document.createElement("div");this.__foreground=document.createElement("div");a.bind(this.__background,"mousedown",function(b){a.bind(window,"mousemove",u);a.bind(window,"mouseup",x);u(b)});a.addClass(this.__background,"slider");a.addClass(this.__foreground,"slider-fg");this.updateDisplay();this.__background.appendChild(this.__foreground);this.domElement.appendChild(this.__background)};t.superclass=f;t.useDefaultStyles=function(){e.inject(d)};c.extend(t.prototype,f.prototype,{updateDisplay:function(){var a= +(this.getValue()-this.__min)/(this.__max-this.__min);this.__foreground.style.width=100*a+"%";return t.superclass.prototype.updateDisplay.call(this)}});return t}(dat.controllers.NumberController,dat.dom.dom,dat.utils.css,dat.utils.common,"/**\n * dat-gui JavaScript Controller Library\n * http://code.google.com/p/dat-gui\n *\n * Copyright 2011 Data Arts Team, Google Creative Lab\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n */\n\n.slider {\n box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);\n height: 1em;\n border-radius: 1em;\n background-color: #eee;\n padding: 0 0.5em;\n overflow: hidden;\n}\n\n.slider-fg {\n padding: 1px 0 2px 0;\n background-color: #aaa;\n height: 1em;\n margin-left: -0.5em;\n padding-right: 0.5em;\n border-radius: 1em 0 0 1em;\n}\n\n.slider-fg:after {\n display: inline-block;\n border-radius: 1em;\n background-color: #fff;\n border: 1px solid #aaa;\n content: '';\n float: right;\n margin-right: -1em;\n margin-top: -1px;\n height: 0.9em;\n width: 0.9em;\n}\n"); +dat.controllers.FunctionController=function(f,a,e){var c=function(d,b,e){c.superclass.call(this,d,b);var f=this;this.__button=document.createElement("div");this.__button.innerHTML=void 0===e?"Fire":e;a.bind(this.__button,"click",function(a){a.preventDefault();f.fire();return!1});a.addClass(this.__button,"button");this.domElement.appendChild(this.__button)};c.superclass=f;e.extend(c.prototype,f.prototype,{fire:function(){this.__onChange&&this.__onChange.call(this);this.getValue().call(this.object); +this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}});return c}(dat.controllers.Controller,dat.dom.dom,dat.utils.common); +dat.controllers.BooleanController=function(f,a,e){var c=function(d,b){c.superclass.call(this,d,b);var e=this;this.__prev=this.getValue();this.__checkbox=document.createElement("input");this.__checkbox.setAttribute("type","checkbox");a.bind(this.__checkbox,"change",function(){e.setValue(!e.__prev)},!1);this.domElement.appendChild(this.__checkbox);this.updateDisplay()};c.superclass=f;e.extend(c.prototype,f.prototype,{setValue:function(a){a=c.superclass.prototype.setValue.call(this,a);this.__onFinishChange&& +this.__onFinishChange.call(this,this.getValue());this.__prev=this.getValue();return a},updateDisplay:function(){!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0):this.__checkbox.checked=!1;return c.superclass.prototype.updateDisplay.call(this)}});return c}(dat.controllers.Controller,dat.dom.dom,dat.utils.common); +dat.controllers.UndefinedController=function(f,a,e){var c=function(a,b){c.superclass.call(this,a,b);this.__input=document.createElement("input");this.__input.setAttribute("type","text");this.__input.setAttribute("disabled",!0);this.domElement.appendChild(this.__input)};c.superclass=f;e.extend(c.prototype,f.prototype,{updateDisplay:function(){this.__onFinishChange&&(e.isUndefined(this.object[this.property])||this.__onFinishChange.call(this.object[this.property]));return c.superclass.prototype.updateDisplay.call(this)}}); +return c}(dat.controllers.Controller,dat.dom.dom,dat.utils.common);dat.color.toString=function(f){return function(a){if(1==a.a||f.isUndefined(a.a)){for(a=a.hex.toString(16);6>a.length;)a="0"+a;return"#"+a}return"rgba("+Math.round(a.r)+","+Math.round(a.g)+","+Math.round(a.b)+","+a.a+")"}}(dat.utils.common); +dat.color.interpret=function(f,a){var e,c,d=[{litmus:a.isString,conversions:{THREE_CHAR_HEX:{read:function(a){a=a.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null===a?!1:{space:"HEX",hex:parseInt("0x"+a[1].toString()+a[1].toString()+a[2].toString()+a[2].toString()+a[3].toString()+a[3].toString())}},write:f},SIX_CHAR_HEX:{read:function(a){a=a.match(/^#([A-F0-9]{6})$/i);return null===a?!1:{space:"HEX",hex:parseInt("0x"+a[1].toString())}},write:f},CSS_RGB:{read:function(a){a=a.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/); +return null===a?!1:{space:"RGB",r:parseFloat(a[1]),g:parseFloat(a[2]),b:parseFloat(a[3])}},write:f},CSS_RGBA:{read:function(a){a=a.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\,\s*(.+)\s*\)/);return null===a?!1:{space:"RGB",r:parseFloat(a[1]),g:parseFloat(a[2]),b:parseFloat(a[3]),a:parseFloat(a[4])}},write:f}}},{litmus:a.isNumber,conversions:{HEX:{read:function(a){return{space:"HEX",hex:a,conversionName:"HEX"}},write:function(a){return a.hex}}}},{litmus:a.isArray,conversions:{RGB_ARRAY:{read:function(a){return 3!= a.length?!1:{space:"RGB",r:a[0],g:a[1],b:a[2]}},write:function(a){return[a.r,a.g,a.b]}},RGBA_ARRAY:{read:function(a){return 4!=a.length?!1:{space:"RGB",r:a[0],g:a[1],b:a[2],a:a[3]}},write:function(a){return[a.r,a.g,a.b,a.a]}}}},{litmus:a.isObject,conversions:{RGBA_OBJ:{read:function(b){return a.isNumber(b.r)&&a.isNumber(b.g)&&a.isNumber(b.b)&&a.isNumber(b.a)?{space:"RGB",r:b.r,g:b.g,b:b.b,a:b.a}:!1},write:function(a){return{r:a.r,g:a.g,b:a.b,a:a.a}}},RGB_OBJ:{read:function(b){return a.isNumber(b.r)&& -a.isNumber(b.g)&&a.isNumber(b.b)?{space:"RGB",r:b.r,g:b.g,b:b.b}:!1},write:function(a){return{r:a.r,g:a.g,b:a.b}}},HSVA_OBJ:{read:function(b){return a.isNumber(b.h)&&a.isNumber(b.s)&&a.isNumber(b.v)&&a.isNumber(b.a)?{space:"HSV",h:b.h,s:b.s,v:b.v,a:b.a}:!1},write:function(a){return{h:a.h,s:a.s,v:a.v,a:a.a}}},HSV_OBJ:{read:function(b){return a.isNumber(b.h)&&a.isNumber(b.s)&&a.isNumber(b.v)?{space:"HSV",h:b.h,s:b.s,v:b.v}:!1},write:function(a){return{h:a.h,s:a.s,v:a.v}}}}}];return function(){b=!1; -var e=1\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save values to localStorage on exit.\n\n
The values saved to localStorage will override those passed to dat.GUI\'s constructor. This makes it easier to work incrementally, but localStorage is fragile, and your friends may not see the same values you do.\n\n
\n\n
\n\n\n', ".dg {\n /** Clear list styles */\n /* Auto-place container */\n /* Auto-placed GUI's */\n /* Line items that don't contain folders. */\n /** Folder names */\n /** Hides closed items */\n /** Controller row */\n /** Name-half (left) */\n /** Controller-half (right) */\n /** Controller placement */\n /** Shorter number boxes when slider is present. */\n /** Ensure the entire boolean and function row shows a hand */\n}\n\n.dg ul {\n list-style: none;\n margin: 0;\n padding: 0;\n width: 100%;\n clear: both;\n}\n\n.dg.ac {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n height: 0;\n z-index: 0;\n}\n\n.dg:not(.ac) .main {\n /** Exclude mains in ac so that we don't hide close button */\n overflow: hidden;\n}\n\n.dg.main {\n -webkit-transition: opacity 0.1s linear;\n -o-transition: opacity 0.1s linear;\n -moz-transition: opacity 0.1s linear;\n transition: opacity 0.1s linear;\n}\n\n.dg.main.taller-than-window {\n overflow-y: auto;\n}\n\n.dg.main.taller-than-window .close-button {\n opacity: 1;\n /* TODO, these are style notes */\n margin-top: -1px;\n border-top: 1px solid #2c2c2c;\n}\n\n.dg.main ul.closed .close-button {\n opacity: 1 !important;\n}\n\n.dg.main:hover .close-button,\n.dg.main .close-button.drag {\n opacity: 1;\n}\n\n.dg.main .close-button {\n /*opacity: 0;*/\n -webkit-transition: opacity 0.1s linear;\n -o-transition: opacity 0.1s linear;\n -moz-transition: opacity 0.1s linear;\n transition: opacity 0.1s linear;\n border: 0;\n position: absolute;\n line-height: 19px;\n height: 20px;\n /* TODO, these are style notes */\n cursor: pointer;\n text-align: center;\n background-color: #000;\n}\n\n.dg.main .close-button:hover {\n background-color: #111;\n}\n\n.dg.a {\n float: right;\n margin-right: 15px;\n overflow-x: hidden;\n}\n\n.dg.a.has-save> ul {\n margin-top: 27px;\n}\n\n.dg.a.has-save> ul.closed {\n margin-top: 0;\n}\n\n.dg.a .save-row {\n position: fixed;\n top: 0;\n z-index: 1002;\n}\n\n.dg li {\n -webkit-transition: height 0.1s ease-out;\n -o-transition: height 0.1s ease-out;\n -moz-transition: height 0.1s ease-out;\n transition: height 0.1s ease-out;\n}\n\n.dg li:not(.folder) {\n cursor: auto;\n height: 27px;\n line-height: 27px;\n overflow: hidden;\n padding: 0 4px 0 5px;\n}\n\n.dg li.folder {\n padding: 0;\n border-left: 4px solid rgba(0, 0, 0, 0);\n}\n\n.dg li.title {\n cursor: pointer;\n margin-left: -4px;\n}\n\n.dg .closed li:not(.title),\n.dg .closed ul li,\n.dg .closed ul li> * {\n height: 0;\n overflow: hidden;\n border: 0;\n}\n\n.dg .cr {\n clear: both;\n padding-left: 3px;\n height: 27px;\n}\n\n.dg .property-name {\n cursor: default;\n float: left;\n clear: left;\n width: 40%;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.dg .c {\n float: left;\n width: 60%;\n}\n\n.dg .c input[type=text] {\n border: 0;\n margin-top: 4px;\n padding: 3px;\n width: 100%;\n float: right;\n}\n\n.dg .has-slider input[type=text] {\n width: 30%;\n /*display: none;*/\n margin-left: 0;\n}\n\n.dg .slider {\n float: left;\n width: 66%;\n margin-left: -5px;\n margin-right: 0;\n height: 19px;\n margin-top: 4px;\n}\n\n.dg .slider-fg {\n height: 100%;\n}\n\n.dg .c input[type=checkbox] {\n margin-top: 9px;\n}\n\n.dg .c select {\n margin-top: 5px;\n}\n\n.dg .cr.function,\n.dg .cr.function .property-name,\n.dg .cr.function *,\n.dg .cr.boolean,\n.dg .cr.boolean * {\n cursor: pointer;\n}\n\n.dg .selector {\n display: none;\n position: absolute;\n margin-left: -9px;\n margin-top: 23px;\n z-index: 10;\n}\n\n.dg .c:hover .selector,\n.dg .selector.drag {\n display: block;\n}\n\n.dg li.save-row {\n padding: 0;\n}\n\n.dg li.save-row .button {\n display: inline-block;\n padding: 0px 6px;\n}\n\n.dg.dialogue {\n background-color: #222;\n width: 460px;\n padding: 15px;\n font-size: 13px;\n line-height: 15px;\n}\n\n\n/* TODO Separate style and structure */\n\n#dg-new-constructor {\n padding: 10px;\n color: #222;\n font-family: Monaco, monospace;\n font-size: 10px;\n border: 0;\n resize: none;\n box-shadow: inset 1px 1px 1px #888;\n word-wrap: break-word;\n margin: 12px 0;\n display: block;\n width: 440px;\n overflow-y: scroll;\n height: 100px;\n position: relative;\n}\n\n#dg-local-explain {\n display: none;\n font-size: 11px;\n line-height: 17px;\n border-radius: 3px;\n background-color: #333;\n padding: 8px;\n margin-top: 10px;\n}\n\n#dg-local-explain code {\n font-size: 10px;\n}\n\n#dat-gui-save-locally {\n display: none;\n}\n\n\n/** Main type */\n\n.dg {\n color: #eee;\n font: 11px 'Lucida Grande', sans-serif;\n text-shadow: 0 -1px 0 #111;\n /** Auto place */\n /* Controller row,
  • */\n /** Controllers */\n}\n\n.dg.main {\n /** Scrollbar */\n}\n\n.dg.main::-webkit-scrollbar {\n width: 5px;\n background: #1a1a1a;\n}\n\n.dg.main::-webkit-scrollbar-corner {\n height: 0;\n display: none;\n}\n\n.dg.main::-webkit-scrollbar-thumb {\n border-radius: 5px;\n background: #676767;\n}\n\n.dg li:not(.folder) {\n background: #1a1a1a;\n border-bottom: 1px solid #2c2c2c;\n}\n\n.dg li.save-row {\n line-height: 25px;\n background: #dad5cb;\n border: 0;\n}\n\n.dg li.save-row select {\n margin-left: 5px;\n width: 108px;\n}\n\n.dg li.save-row .button {\n margin-left: 5px;\n margin-top: 1px;\n border-radius: 2px;\n font-size: 9px;\n line-height: 7px;\n padding: 4px 4px 5px 4px;\n background: #c5bdad;\n color: #fff;\n text-shadow: 0 1px 0 #b0a58f;\n box-shadow: 0 -1px 0 #b0a58f;\n cursor: pointer;\n}\n\n.dg li.save-row .button.gears {\n background: #c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;\n height: 7px;\n width: 8px;\n}\n\n.dg li.save-row .button:hover {\n background-color: #bab19e;\n box-shadow: 0 -1px 0 #b0a58f;\n}\n\n.dg li.folder {\n border-bottom: 0;\n}\n\n.dg li.title {\n padding-left: 16px;\n background: black url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;\n cursor: pointer;\n border-bottom: 1px solid rgba(255, 255, 255, 0.2);\n}\n\n.dg .closed li.title {\n background-image: url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==);\n}\n\n.dg .cr.boolean {\n border-left: 3px solid #806787;\n}\n\n.dg .cr.function {\n border-left: 3px solid #e61d5f;\n}\n\n.dg .cr.number {\n border-left: 3px solid #2fa1d6;\n}\n\n.dg .cr.number input[type=text] {\n color: #2fa1d6;\n}\n\n.dg .cr.string {\n border-left: 3px solid #1ed36f;\n}\n\n.dg .cr.string input[type=text] {\n color: #1ed36f;\n}\n\n.dg .cr.function:hover,\n.dg .cr.boolean:hover {\n background: #111;\n}\n\n.dg .c input[type=text] {\n background: #303030;\n outline: none;\n}\n\n.dg .c input[type=text]:hover {\n background: #3c3c3c;\n}\n\n.dg .c input[type=text]:focus {\n background: #494949;\n color: #fff;\n}\n\n.dg .c .slider {\n background: #303030;\n cursor: ew-resize;\n}\n\n.dg .c .slider-fg {\n background: #2fa1d6;\n}\n\n.dg .c .slider:hover {\n background: #3c3c3c;\n}\n\n.dg .c .slider:hover .slider-fg {\n background: #44abda;\n}\n\n.dg .cr.undefined {\n border-left: 3px dotted #919191;\n}\n\n.dg .cr.undefined input[type=text] {\n background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAJElEQVQIW2OcOHHi//z8fEYGJADmoEvAVSBLoGiDSaAIwowCAAMYEriV4NZdAAAAAElFTkSuQmCC) repeat;\n}\n", -dat.controllers.factory=function(d,a,c,b,f,e,r,l){return function(k,q,n,v){var u=k[q];if(l.isArray(n)||l.isObject(n))return new d(k,q,n);if(l.isNumber(u))return l.isNumber(n)&&l.isNumber(v)?new c(k,q,n,v):new a(k,q,{min:n,max:v});if(l.isString(u))return new b(k,q);if(l.isFunction(u))return new f(k,q,"");if(l.isBoolean(u))return new e(k,q);if(l.isUndefined(u))return new r(k,q)}}(dat.controllers.OptionController,dat.controllers.NumberControllerBox,dat.controllers.NumberControllerSlider,dat.controllers.StringController= -function(d,a,c){var b=function(c,d){function r(){l.setValue(l.__input.value)}b.superclass.call(this,c,d);var l=this;this.__input=document.createElement("input");this.__input.setAttribute("type","text");a.bind(this.__input,"keyup",r);a.bind(this.__input,"change",r);a.bind(this.__input,"blur",function(){l.__onFinishChange&&l.__onFinishChange.call(l,l.getValue())});a.bind(this.__input,"keydown",function(a){13===a.keyCode&&this.blur()});this.updateDisplay();this.domElement.appendChild(this.__input)}; -b.superclass=d;c.extend(b.prototype,d.prototype,{updateDisplay:function(){a.isActive(this.__input)||(this.__input.value=this.getValue());return b.superclass.prototype.updateDisplay.call(this)}});return b}(dat.controllers.Controller,dat.dom.dom,dat.utils.common),dat.controllers.FunctionController,dat.controllers.BooleanController,dat.controllers.UndefinedController,dat.utils.common),dat.controllers.Controller,dat.controllers.BooleanController,dat.controllers.FunctionController,dat.controllers.NumberControllerBox, -dat.controllers.NumberControllerSlider,dat.controllers.OptionController,dat.controllers.ColorController=function(d,a,c,b,f){function e(a,b,c,d){a.style.background="";f.each(k,function(e){a.style.cssText+="background: "+e+"linear-gradient("+b+", "+c+" 0%, "+d+" 100%); "})}function r(a){a.style.background="";a.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);";a.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"; -a.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";a.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";a.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var l=function(d,n){function k(b){m(b);a.bind(window,"mousemove",m);a.bind(window, -"mouseup",u)}function u(){a.unbind(window,"mousemove",m);a.unbind(window,"mouseup",u)}function x(){var a=b(this.value);!1!==a?(t.__color.__state=a,t.setValue(t.__color.toOriginal())):this.value=t.__color.toString()}function g(){a.unbind(window,"mousemove",w);a.unbind(window,"mouseup",g)}function m(b){b.preventDefault();var c=a.getWidth(t.__saturation_field),d=a.getOffset(t.__saturation_field),e=(b.clientX-d.left+document.body.scrollLeft)/c;b=1-(b.clientY-d.top+document.body.scrollTop)/c;1 -b&&(b=0);1e&&(e=0);t.__color.v=b;t.__color.s=e;t.setValue(t.__color.toOriginal());return!1}function w(b){b.preventDefault();var c=a.getHeight(t.__hue_field),d=a.getOffset(t.__hue_field);b=1-(b.clientY-d.top+document.body.scrollTop)/c;1b&&(b=0);t.__color.h=360*b;t.setValue(t.__color.toOriginal());return!1}l.superclass.call(this,d,n);this.__color=new c(this.getValue());this.__temp=new c(0);var t=this;this.domElement=document.createElement("div");a.makeSelectable(this.domElement,!1); +dat.controllers.factory=function(f,a,e,c,d,b,t,n){return function(k,q,m,v){var u=k[q];if(n.isArray(m)||n.isObject(m))return new f(k,q,m);if(n.isNumber(u))return n.isNumber(m)&&n.isNumber(v)?new e(k,q,m,v):new a(k,q,{min:m,max:v});if(n.isString(u))return new c(k,q);if(n.isFunction(u))return new d(k,q,"");if(n.isBoolean(u))return new b(k,q);if(n.isUndefined(u))return new t(k,q)}}(dat.controllers.OptionController,dat.controllers.NumberControllerBox,dat.controllers.NumberControllerSlider,dat.controllers.StringController= +function(f,a,e){var c=function(d,b){function e(){f.setValue(f.__input.value)}c.superclass.call(this,d,b);var f=this;this.__input=document.createElement("input");this.__input.setAttribute("type","text");a.bind(this.__input,"keyup",e);a.bind(this.__input,"change",e);a.bind(this.__input,"blur",function(){f.__onFinishChange&&f.__onFinishChange.call(f,f.getValue())});a.bind(this.__input,"keydown",function(a){13===a.keyCode&&this.blur()});this.updateDisplay();this.domElement.appendChild(this.__input)}; +c.superclass=f;e.extend(c.prototype,f.prototype,{updateDisplay:function(){a.isActive(this.__input)||(this.__input.value=this.getValue());return c.superclass.prototype.updateDisplay.call(this)}});return c}(dat.controllers.Controller,dat.dom.dom,dat.utils.common),dat.controllers.FunctionController,dat.controllers.BooleanController,dat.controllers.UndefinedController,dat.utils.common),dat.controllers.Controller,dat.controllers.BooleanController,dat.controllers.FunctionController,dat.controllers.NumberControllerBox, +dat.controllers.NumberControllerSlider,dat.controllers.OptionController,dat.controllers.ColorController=function(f,a,e,c,d){function b(a,b,c,e){a.style.background="";d.each(k,function(d){a.style.cssText+="background: "+d+"linear-gradient("+b+", "+c+" 0%, "+e+" 100%); "})}function t(a){a.style.background="";a.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);";a.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"; +a.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";a.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";a.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var n=function(f,m){function k(b){l(b);a.bind(window,"mousemove",l);a.bind(window, +"mouseup",u)}function u(){a.unbind(window,"mousemove",l);a.unbind(window,"mouseup",u)}function x(){var a=c(this.value);!1!==a?(r.__color.__state=a,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function g(){a.unbind(window,"mousemove",w);a.unbind(window,"mouseup",g)}function l(b){b.preventDefault();var c=a.getWidth(r.__saturation_field),d=a.getOffset(r.__saturation_field),e=(b.clientX-d.left+document.body.scrollLeft)/c;b=1-(b.clientY-d.top+document.body.scrollTop)/c;1 +b&&(b=0);1e&&(e=0);r.__color.v=b;r.__color.s=e;r.setValue(r.__color.toOriginal());return!1}function w(b){b.preventDefault();var c=a.getHeight(r.__hue_field),d=a.getOffset(r.__hue_field);b=1-(b.clientY-d.top+document.body.scrollTop)/c;1b&&(b=0);r.__color.h=360*b;r.setValue(r.__color.toOriginal());return!1}n.superclass.call(this,f,m);this.__color=new e(this.getValue());this.__temp=new e(0);var r=this;this.domElement=document.createElement("div");a.makeSelectable(this.domElement,!1); this.__selector=document.createElement("div");this.__selector.className="selector";this.__saturation_field=document.createElement("div");this.__saturation_field.className="saturation-field";this.__field_knob=document.createElement("div");this.__field_knob.className="field-knob";this.__field_knob_border="2px solid ";this.__hue_knob=document.createElement("div");this.__hue_knob.className="hue-knob";this.__hue_field=document.createElement("div");this.__hue_field.className="hue-field";this.__input=document.createElement("input"); -this.__input.type="text";this.__input_textShadow="0 1px 1px ";a.bind(this.__input,"keydown",function(a){13===a.keyCode&&x.call(this)});a.bind(this.__input,"blur",x);a.bind(this.__selector,"mousedown",function(b){a.addClass(this,"drag").bind(window,"mouseup",function(b){a.removeClass(t.__selector,"drag")})});var A=document.createElement("div");f.extend(this.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"});f.extend(this.__field_knob.style, -{position:"absolute",width:"12px",height:"12px",border:this.__field_knob_border+(.5>this.__color.v?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1});f.extend(this.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1});f.extend(this.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"});f.extend(A.style,{width:"100%",height:"100%", -background:"none"});e(A,"top","rgba(0,0,0,0)","#000");f.extend(this.__hue_field.style,{width:"15px",height:"100px",display:"inline-block",border:"1px solid #555",cursor:"ns-resize"});r(this.__hue_field);f.extend(this.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:this.__input_textShadow+"rgba(0,0,0,0.7)"});a.bind(this.__saturation_field,"mousedown",k);a.bind(this.__field_knob,"mousedown",k);a.bind(this.__hue_field,"mousedown",function(b){w(b);a.bind(window, -"mousemove",w);a.bind(window,"mouseup",g)});this.__saturation_field.appendChild(A);this.__selector.appendChild(this.__field_knob);this.__selector.appendChild(this.__saturation_field);this.__selector.appendChild(this.__hue_field);this.__hue_field.appendChild(this.__hue_knob);this.domElement.appendChild(this.__input);this.domElement.appendChild(this.__selector);this.updateDisplay()};l.superclass=d;f.extend(l.prototype,d.prototype,{updateDisplay:function(){var a=b(this.getValue());if(!1!==a){var d=!1; -f.each(c.COMPONENTS,function(b){if(!f.isUndefined(a[b])&&!f.isUndefined(this.__color.__state[b])&&a[b]!==this.__color.__state[b])return d=!0,{}},this);d&&f.extend(this.__color.__state,a)}f.extend(this.__temp.__state,this.__color.__state);this.__temp.a=1;var k=.5>this.__color.v||.5a&&(a+=1);return{h:360*a,s:e/d,v:d/255}},rgb_to_hex:function(a,c,b){a=this.hex_with_component(0,2,a);a=this.hex_with_component(a,1,c);return a=this.hex_with_component(a,0,b)},component_from_hex:function(a,c){return a>>8*c&255},hex_with_component:function(a,c,b){return b<<(d=8*c)|a&~(255<this.__color.v?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1});d.extend(this.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1});d.extend(this.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"});d.extend(A.style,{width:"100%",height:"100%", +background:"none"});b(A,"top","rgba(0,0,0,0)","#000");d.extend(this.__hue_field.style,{width:"15px",height:"100px",display:"inline-block",border:"1px solid #555",cursor:"ns-resize"});t(this.__hue_field);d.extend(this.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:this.__input_textShadow+"rgba(0,0,0,0.7)"});a.bind(this.__saturation_field,"mousedown",k);a.bind(this.__field_knob,"mousedown",k);a.bind(this.__hue_field,"mousedown",function(b){w(b);a.bind(window, +"mousemove",w);a.bind(window,"mouseup",g)});this.__saturation_field.appendChild(A);this.__selector.appendChild(this.__field_knob);this.__selector.appendChild(this.__saturation_field);this.__selector.appendChild(this.__hue_field);this.__hue_field.appendChild(this.__hue_knob);this.domElement.appendChild(this.__input);this.domElement.appendChild(this.__selector);this.updateDisplay()};n.superclass=f;d.extend(n.prototype,f.prototype,{updateDisplay:function(){var a=c(this.getValue());if(!1!==a){var f=!1; +d.each(e.COMPONENTS,function(b){if(!d.isUndefined(a[b])&&!d.isUndefined(this.__color.__state[b])&&a[b]!==this.__color.__state[b])return f=!0,{}},this);f&&d.extend(this.__color.__state,a)}d.extend(this.__temp.__state,this.__color.__state);this.__temp.a=1;var k=.5>this.__color.v||.5a&&(a+=1);return{h:360*a,s:b/d,v:d/255}},rgb_to_hex:function(a,e,c){a=this.hex_with_component(0,2,a);a=this.hex_with_component(a,1,e);return a=this.hex_with_component(a,0,c)},component_from_hex:function(a,e){return a>>8*e&255},hex_with_component:function(a,e,c){return c<<(f=8*e)|a&~(255<