diff --git a/README.md b/README.md index f23be05..c33ba55 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,8 @@ This will create a namespaced, unminified build of dat.GUI at `build/dat.gui.mai * Using common.js * Using webpack for build * Fixed an issue with colors based on arrays - https://github.com/dataarts/dat.gui/pull/57 - + * Update factory.js, Step param was not used - https://github.com/dataarts/dat.gui/pull/45 + ### 0.5 * Moved to requirejs for dependency management. * Changed global namespace from *DAT* to *dat* (lowercase). diff --git a/build/dat.gui.js b/build/dat.gui.js index 2dd2620..5bb12f2 100644 --- a/build/dat.gui.js +++ b/build/dat.gui.js @@ -4209,40 +4209,47 @@ return /******/ (function(modules) { // webpackBootstrap BooleanController = __webpack_require__(8), common = __webpack_require__(5); - module.exports = function(object, property) { + module.exports = function (object, property) { - var initialValue = object[property]; + var initialValue = object[property]; - // Providing options? - if (common.isArray(arguments[2]) || common.isObject(arguments[2])) { - return new OptionController(object, property, arguments[2]); - } - - // Providing a map? - - if (common.isNumber(initialValue)) { - - if (common.isNumber(arguments[2]) && common.isNumber(arguments[3])) { - // Has min and max. - return new NumberControllerSlider(object, property, arguments[2], arguments[3]); - - } else { - - return new NumberControllerBox(object, property, { min: arguments[2], max: arguments[3] }); + // Providing options? + if (common.isArray(arguments[2]) || common.isObject(arguments[2])) { + return new OptionController(object, property, arguments[2]); } - } - if (common.isString(initialValue)) { - return new StringController(object, property); - } + // Providing a map? - if (common.isFunction(initialValue)) { - return new FunctionController(object, property, ''); - } + if (common.isNumber(initialValue)) { + + if (common.isNumber(arguments[2]) && common.isNumber(arguments[3])) { + + // Has min and max. + if (common.isNumber(arguments[4])) // has step + return new NumberControllerSlider(object, property, arguments[2], arguments[3], arguments[4]); + else + return new NumberControllerSlider(object, property, arguments[2], arguments[3]); + + } else { + + return new NumberControllerBox(object, property, {min: arguments[2], max: arguments[3]}); + + } + + } + + if (common.isString(initialValue)) { + return new StringController(object, property); + } + + if (common.isFunction(initialValue)) { + return new FunctionController(object, property, ''); + } + + if (common.isBoolean(initialValue)) { + return new BooleanController(object, property); + } - if (common.isBoolean(initialValue)) { - return new BooleanController(object, property); - } }; /***/ }, diff --git a/build/dat.gui.min.js b/build/dat.gui.min.js index 13b94cf..f8a65f2 100644 --- a/build/dat.gui.min.js +++ b/build/dat.gui.min.js @@ -1,2 +1,2 @@ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):"object"==typeof exports?exports.dat=t():e.dat=t()}(this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return e[i].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){e.exports={color:{Color:n(2),math:n(6),interpret:n(3)},controllers:{Controller:n(7),BooleanController:n(8),OptionController:n(10),StringController:n(11),NumberController:n(12),NumberControllerBox:n(13),NumberControllerSlider:n(14),FunctionController:n(20),ColorController:n(21)},dom:{dom:n(9)},gui:{GUI:n(22)}}},function(e,t,n){function i(e,t,n){Object.defineProperty(e,t,{get:function(){return"RGB"===this.__state.space?this.__state[t]:(r(this,t,n),this.__state[t])},set:function(e){"RGB"!==this.__state.space&&(r(this,t,n),this.__state.space="RGB"),this.__state[t]=e}})}function o(e,t){Object.defineProperty(e,t,{get:function(){return"HSV"===this.__state.space?this.__state[t]:(s(this),this.__state[t])},set:function(e){"HSV"!==this.__state.space&&(s(this),this.__state.space="HSV"),this.__state[t]=e}})}function r(e,t,n){if("HEX"===e.__state.space)e.__state[t]=l.component_from_hex(e.__state.hex,n);else{if("HSV"!==e.__state.space)throw"Corrupted color state";c.extend(e.__state,l.hsv_to_rgb(e.__state.h,e.__state.s,e.__state.v))}}function s(e){var t=l.rgb_to_hsv(e.r,e.g,e.b);c.extend(e.__state,{s:t.s,v:t.v}),c.isNaN(t.h)?c.isUndefined(e.__state.h)&&(e.__state.h=0):e.__state.h=t.h}var a=n(3),l=n(6),d=n(4),c=n(5),u=function(){if(this.__state=a.apply(this,arguments),this.__state===!1)throw"Failed to interpret color arguments";this.__state.a=this.__state.a||1};u.COMPONENTS=["r","g","b","h","s","v","hex","a"],c.extend(u.prototype,{toString:function(){return d(this)},toOriginal:function(){return this.__state.conversion.write(this)}}),i(u.prototype,"r",2),i(u.prototype,"g",1),i(u.prototype,"b",0),o(u.prototype,"h"),o(u.prototype,"s"),o(u.prototype,"v"),Object.defineProperty(u.prototype,"a",{get:function(){return this.__state.a},set:function(e){this.__state.a=e}}),Object.defineProperty(u.prototype,"hex",{get:function(){return"HEX"!==!this.__state.space&&(this.__state.hex=l.rgb_to_hex(this.r,this.g,this.b)),this.__state.hex},set:function(e){this.__state.space="HEX",this.__state.hex=e}}),e.exports=u},function(e,t,n){var i,o,r=n(4),s=n(5),a=function(){o=!1;var e=arguments.length>1?s.toArray(arguments):arguments[0];return s.each(l,function(t){return t.litmus(e)?(s.each(t.conversions,function(t,n){return i=t.read(e),o===!1&&i!==!1?(o=i,i.conversionName=n,i.conversion=t,s.BREAK):void 0}),s.BREAK):void 0}),o},l=[{litmus:s.isString,conversions:{THREE_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null===t?!1:{space:"HEX",hex:parseInt("0x"+t[1].toString()+t[1].toString()+t[2].toString()+t[2].toString()+t[3].toString()+t[3].toString())}},write:r},SIX_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9]{6})$/i);return null===t?!1:{space:"HEX",hex:parseInt("0x"+t[1].toString())}},write:r},CSS_RGB:{read:function(e){var t=e.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null===t?!1:{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3])}},write:r},CSS_RGBA:{read:function(e){var t=e.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\,\s*(.+)\s*\)/);return null===t?!1:{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3]),a:parseFloat(t[4])}},write:r}}},{litmus:s.isNumber,conversions:{HEX:{read:function(e){return{space:"HEX",hex:e,conversionName:"HEX"}},write:function(e){return e.hex}}}},{litmus:s.isArray,conversions:{RGB_ARRAY:{read:function(e){return 3!=e.length?!1:{space:"RGB",r:e[0],g:e[1],b:e[2]}},write:function(e){return[e.r,e.g,e.b]}},RGBA_ARRAY:{read:function(e){return 4!=e.length?!1:{space:"RGB",r:e[0],g:e[1],b:e[2],a:e[3]}},write:function(e){return[e.r,e.g,e.b,e.a]}}}},{litmus:s.isObject,conversions:{RGBA_OBJ:{read:function(e){return s.isNumber(e.r)&&s.isNumber(e.g)&&s.isNumber(e.b)&&s.isNumber(e.a)?{space:"RGB",r:e.r,g:e.g,b:e.b,a:e.a}:!1},write:function(e){return{r:e.r,g:e.g,b:e.b,a:e.a}}},RGB_OBJ:{read:function(e){return s.isNumber(e.r)&&s.isNumber(e.g)&&s.isNumber(e.b)?{space:"RGB",r:e.r,g:e.g,b:e.b}:!1},write:function(e){return{r:e.r,g:e.g,b:e.b}}},HSVA_OBJ:{read:function(e){return s.isNumber(e.h)&&s.isNumber(e.s)&&s.isNumber(e.v)&&s.isNumber(e.a)?{space:"HSV",h:e.h,s:e.s,v:e.v,a:e.a}:!1},write:function(e){return{h:e.h,s:e.s,v:e.v,a:e.a}}},HSV_OBJ:{read:function(e){return s.isNumber(e.h)&&s.isNumber(e.s)&&s.isNumber(e.v)?{space:"HSV",h:e.h,s:e.s,v:e.v}:!1},write:function(e){return{h:e.h,s:e.s,v:e.v}}}}}];e.exports=a},function(e,t,n){var i=n(5);e.exports=function(e){if(1==e.a||i.isUndefined(e.a)){for(var t=e.hex.toString(16);t.length<6;)t="0"+t;return"#"+t}return"rgba("+Math.round(e.r)+","+Math.round(e.g)+","+Math.round(e.b)+","+e.a+")"}},function(e,t){var n=Array.prototype.forEach,i=Array.prototype.slice,o={BREAK:{},extend:function(e){return this.each(i.call(arguments,1),function(t){for(var n in t)this.isUndefined(t[n])||(e[n]=t[n])},this),e},defaults:function(e){return this.each(i.call(arguments,1),function(t){for(var n in t)this.isUndefined(e[n])&&(e[n]=t[n])},this),e},compose:function(){var e=i.call(arguments);return function(){for(var t=i.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,i){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,i);else if(e.length===e.length+0){for(var o=0,r=e.length;r>o;o++)if(o in e&&t.call(i,e[o],o)===this.BREAK)return}else for(var o in e)if(t.call(i,e[o],o)===this.BREAK)return},defer:function(e){setTimeout(e,0)},toArray:function(e){return e.toArray?e.toArray():i.call(e)},isUndefined:function(e){return void 0===e},isNull:function(e){return null===e},isNaN:function(e){return e!==e},isArray:Array.isArray||function(e){return e.constructor===Array},isObject:function(e){return e===Object(e)},isNumber:function(e){return e===e+0},isString:function(e){return e===e+""},isBoolean:function(e){return e===!1||e===!0},isFunction:function(e){return"[object Function]"===Object.prototype.toString.call(e)}};e.exports=o},function(e,t){var n,i={hsv_to_rgb:function(e,t,n){var i=Math.floor(e/60)%6,o=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-o*t),a=n*(1-(1-o)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][i];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var i,o,r=Math.min(e,t,n),s=Math.max(e,t,n),a=s-r;return 0==s?{h:NaN,s:0,v:0}:(o=a/s,i=e==s?(t-n)/a:t==s?2+(n-e)/a:4+(e-t)/a,i/=6,0>i&&(i+=1),{h:360*i,s:o,v:s/255})},rgb_to_hex:function(e,t,n){var i=this.hex_with_component(0,2,e);return i=this.hex_with_component(i,1,t),i=this.hex_with_component(i,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,i){return i<<(n=8*t)|e&~(255<-1?e.length-e.indexOf(".")-1:0}var o=n(7),r=n(5),s=function(e,t,n){s.superclass.call(this,e,t),n=n||{},this.__min=n.min,this.__max=n.max,this.__step=n.step,r.isUndefined(this.__step)?0==this.initialValue?this.__impliedStep=1:this.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(this.initialValue))/Math.LN10))/10:this.__impliedStep=this.__step,this.__precision=i(this.__impliedStep)};s.superclass=o,r.extend(s.prototype,o.prototype,{setValue:function(e){return void 0!==this.__min&&ethis.__max&&(e=this.__max),void 0!==this.__step&&e%this.__step!=0&&(e=Math.round(e/this.__step)*this.__step),s.superclass.prototype.setValue.call(this,e)},min:function(e){return this.__min=e,this},max:function(e){return this.__max=e,this},step:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=i(e),this}}),e.exports=s},function(e,t,n){function i(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var o=(n(7),n(12)),r=n(9),s=n(5),a=function(e,t,n){function i(){var e=parseFloat(h.__input.value);s.isNaN(e)||h.setValue(e)}function o(){i(),h.__onFinishChange&&h.__onFinishChange.call(h,h.getValue())}function l(e){r.bind(window,"mousemove",d),r.bind(window,"mouseup",c),u=e.clientY}function d(e){var t=u-e.clientY;h.setValue(h.getValue()+t*h.__impliedStep),u=e.clientY}function c(){r.unbind(window,"mousemove",d),r.unbind(window,"mouseup",c)}this.__truncationSuspended=!1,a.superclass.call(this,e,t,n);var u,h=this;this.__input=document.createElement("input"),this.__input.setAttribute("type","text"),r.bind(this.__input,"change",i),r.bind(this.__input,"blur",o),r.bind(this.__input,"mousedown",l),r.bind(this.__input,"keydown",function(e){13===e.keyCode&&(h.__truncationSuspended=!0,this.blur(),h.__truncationSuspended=!1)}),this.updateDisplay(),this.domElement.appendChild(this.__input)};a.superclass=o,s.extend(a.prototype,o.prototype,{updateDisplay:function(){return this.__input.value=this.__truncationSuspended?this.getValue():i(this.getValue(),this.__precision),a.superclass.prototype.updateDisplay.call(this)}}),e.exports=a},function(e,t,n){function i(e,t,n,i,o){return i+(o-i)*((e-t)/(n-t))}var o=n(12),r=n(9),s=n(15),a=n(5),l=n(16),d=function(e,t,n,o,s){function a(e){r.bind(window,"mousemove",l),r.bind(window,"mouseup",c),l(e)}function l(e){e.preventDefault();var t=r.getOffset(u.__background),n=r.getWidth(u.__background);return u.setValue(i(e.clientX,t.left,t.left+n,u.__min,u.__max)),!1}function c(){r.unbind(window,"mousemove",l),r.unbind(window,"mouseup",c),u.__onFinishChange&&u.__onFinishChange.call(u,u.getValue())}d.superclass.call(this,e,t,{min:n,max:o,step:s});var u=this;this.__background=document.createElement("div"),this.__foreground=document.createElement("div"),r.bind(this.__background,"mousedown",a),r.addClass(this.__background,"slider"),r.addClass(this.__foreground,"slider-fg"),this.updateDisplay(),this.__background.appendChild(this.__foreground),this.domElement.appendChild(this.__background)};d.superclass=o,d.useDefaultStyles=function(){s.inject(l)},a.extend(d.prototype,o.prototype,{updateDisplay:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",d.superclass.prototype.updateDisplay.call(this)}}),e.exports=d},function(e,t){e.exports={load:function(e,t){t=t||document;var n=t.createElement("link");n.type="text/css",n.rel="stylesheet",n.href=e,t.getElementsByTagName("head")[0].appendChild(n)},inject:function(e,t){t=t||document;var n=document.createElement("style");n.type="text/css",n.innerHTML=e,t.getElementsByTagName("head")[0].appendChild(n)}}},function(e,t,n){var i=n(17);"string"==typeof i&&(i=[[e.id,i,""]]);n(19)(i,{});i.locals&&(e.exports=i.locals)},function(e,t,n){t=e.exports=n(18)(),t.push([e.id,".slider{box-shadow:inset 0 2px 4px rgba(0,0,0,.15);height:1em;border-radius:1em;background-color:#eee;padding:0 .5em;overflow:hidden}.slider-fg{padding:1px 0 2px;background-color:#aaa;height:1em;margin-left:-.5em;padding-right:.5em;border-radius:1em 0 0 1em}.slider-fg:after{display:inline-block;border-radius:1em;background-color:#fff;border:1px solid #aaa;content:'';float:right;margin-right:-1em;margin-top:-1px;height:.9em;width:.9em}",""])},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t1?o=1:0>o&&(o=0),i>1?i=1:0>i&&(i=0),_.__color.v=o,_.__color.s=i,_.setValue(_.__color.toOriginal()),!1}function f(e){e.preventDefault();var t=s.getHeight(_.__hue_field),n=s.getOffset(_.__hue_field),i=1-(e.clientY-n.top+document.body.scrollTop)/t;return i>1?i=1:0>i&&(i=0),_.__color.h=360*i,_.setValue(_.__color.toOriginal()),!1}c.superclass.call(this,e,t),this.__color=new a(this.getValue()),this.__temp=new a(0);var _=this;this.domElement=document.createElement("div"),s.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 ",s.bind(this.__input,"keydown",function(e){13===e.keyCode&&u.call(this)}),s.bind(this.__input,"blur",u),s.bind(this.__selector,"mousedown",function(e){s.addClass(this,"drag").bind(window,"mouseup",function(e){s.removeClass(_.__selector,"drag")})});var m=document.createElement("div");d.extend(this.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),d.extend(this.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:this.__field_knob_border+(this.__color.v<.5?"#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(m.style,{width:"100%",height:"100%",background:"none"}),i(m,"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"}),o(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)"}),s.bind(this.__saturation_field,"mousedown",n),s.bind(this.__field_knob,"mousedown",n),s.bind(this.__hue_field,"mousedown",function(e){f(e),s.bind(window,"mousemove",f),s.bind(window,"mouseup",h)}),this.__saturation_field.appendChild(m),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()};c.superclass=r,d.extend(c.prototype,r.prototype,{updateDisplay:function(){var e=l(this.getValue());if(e!==!1){var t=!1;d.each(a.COMPONENTS,function(n){return d.isUndefined(e[n])||d.isUndefined(this.__color.__state[n])||e[n]===this.__color.__state[n]?void 0:(t=!0,{})},this),t&&d.extend(this.__color.__state,e)}d.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;d.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,i(this.__saturation_field,"left","#fff",this.__temp.toString()),d.extend(this.__input.style,{backgroundColor:this.__input.value=this.__color.toString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}});var u=["-moz-","-o-","-webkit-","-ms-",""];e.exports=c},function(e,t,n){function i(e,t,n,i){if(void 0===t[n])throw new Error("Object "+t+' has no property "'+n+'"');var a;if(i.color)a=new A(t,n);else{var l=[t,n].concat(i.factoryArgs);a=v.apply(e,l)}i.before instanceof y&&(i.before=i.before.__li),s(e,a),L.addClass(a.domElement,"c");var d=document.createElement("span");L.addClass(d,"property-name"),d.innerHTML=a.property;var c=document.createElement("div");c.appendChild(d),c.appendChild(a.domElement);var u=o(e,c,i.before);return L.addClass(u,U.CLASS_CONTROLLER_ROW),a instanceof A?L.addClass(u,"color"):L.addClass(u,typeof a.getValue()),r(e,u,a),e.__controllers.push(a),a}function o(e,t,n){var i=document.createElement("li");return t&&i.appendChild(t),n?e.__ul.insertBefore(i,params.before):e.__ul.appendChild(i),e.onResize(),i}function r(e,t,n){if(n.__li=t,n.__gui=e,O.extend(n,{options:function(t){return arguments.length>1?(n.remove(),i(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[O.toArray(arguments)]})):O.isArray(t)||O.isObject(t)?(n.remove(),i(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[t]})):void 0},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof C){var o=new E(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});O.each(["updateDisplay","onChange","onFinishChange"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return t.apply(n,e),i.apply(o,e)}}),L.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof E){var r=function(t){return O.isNumber(n.__min)&&O.isNumber(n.__max)?(n.remove(),i(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]})):t};n.min=O.compose(r,n.min),n.max=O.compose(r,n.max)}else n instanceof x?(L.bind(t,"click",function(){L.fakeEvent(n.__checkbox,"click")}),L.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof w?(L.bind(t,"click",function(){L.fakeEvent(n.__button,"click")}),L.bind(t,"mouseover",function(){L.addClass(n.__button,"hover")}),L.bind(t,"mouseout",function(){L.removeClass(n.__button,"hover")})):n instanceof A&&(L.addClass(t,"color"),n.updateDisplay=O.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=O.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&f(e.getRoot(),!0),t},n.setValue)}function s(e,t){var n=e.getRoot(),i=n.__rememberedObjects.indexOf(t.object);if(-1!=i){var o=n.__rememberedObjectIndecesToControllers[i];if(void 0===o&&(o={},n.__rememberedObjectIndecesToControllers[i]=o),o[t.property]=t,n.load&&n.load.remembered){var r,s=n.load.remembered;if(s[e.preset])r=s[e.preset];else{if(!s[V])return;r=s[V]}if(r[i]&&void 0!==r[i][t.property]){var a=r[i][t.property];t.initialValue=a,t.setValue(a)}}}}function a(e,t){return document.location.href+"."+t}function l(e){function t(){c.style.display=e.useLocalStorage?"block":"none"}var n=e.__save_row=document.createElement("li");L.addClass(e.domElement,"has-save"),e.__ul.insertBefore(n,e.__ul.firstChild),L.addClass(n,"save-row");var i=document.createElement("span");i.innerHTML=" ",L.addClass(i,"button gears");var o=document.createElement("span");o.innerHTML="Save",L.addClass(o,"button"),L.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",L.addClass(r,"button"),L.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",L.addClass(s,"button"),L.addClass(s,"revert");var l=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?O.each(e.load.remembered,function(t,n){h(e,n,n==e.preset)}):h(e,V,!1),L.bind(l,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=u(this)),e.folders={},O.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=u(this),f(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[V]=u(this,!0)),this.load.remembered[e]=u(this),this.preset=e,h(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){O.each(this.__controllers,function(t){this.getRoot().load.remembered?s(e||this.getRoot(),t):t.setValue(t.initialValue)},this),O.each(this.__folders,function(e){e.revert(e)}),e||f(this.getRoot(),!1)},listen:function(e){var t=0==this.__listening.length;this.__listening.push(e),t&&_(this.__listening)}}),e.exports=U},function(e,t){e.exports='
Here\'s the new load parameter for your GUI\'s constructor:
Automatically save values to localStorage on exit.
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.
'},function(e,t,n){var i=n(25);"string"==typeof i&&(i=[[e.id,i,""]]);n(19)(i,{});i.locals&&(e.exports=i.locals)},function(e,t,n){t=e.exports=n(18)(),t.push([e.id,".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1!important}.dg.main .close-button.drag,.dg.main:hover .close-button{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;transition:opacity .1s linear;border:0;position:absolute;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-x:hidden}.dg.a.has-save>ul{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{position:fixed;top:0;z-index:1002}.dg li{-webkit-transition:height .1s ease-out;transition:height .1s ease-out}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;overflow:hidden;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid transparent}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:9px}.dg .c select{margin-top:5px}.dg .cr.boolean,.dg .cr.boolean *,.dg .cr.function,.dg .cr.function *,.dg .cr.function .property-name{cursor:pointer}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco,monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:9pt 0;display:block;width:440px;overflow-y:scroll;height:75pt;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande',sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:81pt}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{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;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:1pc;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid hsla(0,0%,100%,.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2fa1d6}.dg .cr.number input[type=text]{color:#2fa1d6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.boolean:hover,.dg .cr.function:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:0}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2fa1d6}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}",""])},function(e,t,n){var i=n(10),o=n(13),r=n(14),s=n(11),a=n(20),l=n(8),d=n(5);e.exports=function(e,t){var n=e[t];return d.isArray(arguments[2])||d.isObject(arguments[2])?new i(e,t,arguments[2]):d.isNumber(n)?d.isNumber(arguments[2])&&d.isNumber(arguments[3])?new r(e,t,arguments[2],arguments[3]):new o(e,t,{min:arguments[2],max:arguments[3]}):d.isString(n)?new s(e,t):d.isFunction(n)?new a(e,t,""):d.isBoolean(n)?new l(e,t):void 0}},function(e,t){e.exports=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e,t){window.setTimeout(e,1e3/60)}}},function(e,t,n){var i=n(9),o=n(5),r=function(){this.backgroundElement=document.createElement("div"),o.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),i.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),o.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var e=this;i.bind(this.backgroundElement,"click",function(){e.hide()})};r.prototype.show=function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),o.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})},r.prototype.hide=function(){var e=this,t=function(){e.domElement.style.display="none",e.backgroundElement.style.display="none",i.unbind(e.domElement,"webkitTransitionEnd",t),i.unbind(e.domElement,"transitionend",t),i.unbind(e.domElement,"oTransitionEnd",t)};i.bind(this.domElement,"webkitTransitionEnd",t),i.bind(this.domElement,"transitionend",t),i.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"},r.prototype.layout=function(){this.domElement.style.left=window.innerWidth/2-i.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-i.getHeight(this.domElement)/2+"px"},e.exports=r}])}); \ No newline at end of file +var n={};return O.each(e.__rememberedObjects,function(i,o){var r={},s=e.__rememberedObjectIndecesToControllers[o];O.each(s,function(e,n){r[n]=t?e.initialValue:e.getValue()}),n[o]=r}),n}function h(e,t,n){var i=document.createElement("option");i.innerHTML=t,i.value=t,e.__preset_select.appendChild(i),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function p(e){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=u(this)),e.folders={},O.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=u(this),f(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[V]=u(this,!0)),this.load.remembered[e]=u(this),this.preset=e,h(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){O.each(this.__controllers,function(t){this.getRoot().load.remembered?s(e||this.getRoot(),t):t.setValue(t.initialValue)},this),O.each(this.__folders,function(e){e.revert(e)}),e||f(this.getRoot(),!1)},listen:function(e){var t=0==this.__listening.length;this.__listening.push(e),t&&_(this.__listening)}}),e.exports=U},function(e,t){e.exports='
Here\'s the new load parameter for your GUI\'s constructor:
Automatically save values to localStorage on exit.
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.
'},function(e,t,n){var i=n(25);"string"==typeof i&&(i=[[e.id,i,""]]);n(19)(i,{});i.locals&&(e.exports=i.locals)},function(e,t,n){t=e.exports=n(18)(),t.push([e.id,".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1!important}.dg.main .close-button.drag,.dg.main:hover .close-button{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;transition:opacity .1s linear;border:0;position:absolute;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-x:hidden}.dg.a.has-save>ul{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{position:fixed;top:0;z-index:1002}.dg li{-webkit-transition:height .1s ease-out;transition:height .1s ease-out}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;overflow:hidden;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid transparent}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:9px}.dg .c select{margin-top:5px}.dg .cr.boolean,.dg .cr.boolean *,.dg .cr.function,.dg .cr.function *,.dg .cr.function .property-name{cursor:pointer}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco,monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:9pt 0;display:block;width:440px;overflow-y:scroll;height:75pt;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande',sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:81pt}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{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;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:1pc;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid hsla(0,0%,100%,.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2fa1d6}.dg .cr.number input[type=text]{color:#2fa1d6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.boolean:hover,.dg .cr.function:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:0}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2fa1d6}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}",""])},function(e,t,n){var i=n(10),o=n(13),r=n(14),s=n(11),a=n(20),l=n(8),d=n(5);e.exports=function(e,t){var n=e[t];return d.isArray(arguments[2])||d.isObject(arguments[2])?new i(e,t,arguments[2]):d.isNumber(n)?d.isNumber(arguments[2])&&d.isNumber(arguments[3])?d.isNumber(arguments[4])?new r(e,t,arguments[2],arguments[3],arguments[4]):new r(e,t,arguments[2],arguments[3]):new o(e,t,{min:arguments[2],max:arguments[3]}):d.isString(n)?new s(e,t):d.isFunction(n)?new a(e,t,""):d.isBoolean(n)?new l(e,t):void 0}},function(e,t){e.exports=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e,t){window.setTimeout(e,1e3/60)}}},function(e,t,n){var i=n(9),o=n(5),r=function(){this.backgroundElement=document.createElement("div"),o.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),i.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),o.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var e=this;i.bind(this.backgroundElement,"click",function(){e.hide()})};r.prototype.show=function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),o.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})},r.prototype.hide=function(){var e=this,t=function(){e.domElement.style.display="none",e.backgroundElement.style.display="none",i.unbind(e.domElement,"webkitTransitionEnd",t),i.unbind(e.domElement,"transitionend",t),i.unbind(e.domElement,"oTransitionEnd",t)};i.bind(this.domElement,"webkitTransitionEnd",t),i.bind(this.domElement,"transitionend",t),i.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"},r.prototype.layout=function(){this.domElement.style.left=window.innerWidth/2-i.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-i.getHeight(this.domElement)/2+"px"},e.exports=r}])}); \ No newline at end of file diff --git a/src/dat/controllers/factory.js b/src/dat/controllers/factory.js index 6ff2d19..3b2a0cc 100644 --- a/src/dat/controllers/factory.js +++ b/src/dat/controllers/factory.js @@ -19,38 +19,45 @@ var OptionController = require('./OptionController'), BooleanController = require('./BooleanController'), common = require('../utils/common'); - module.exports = function(object, property) { +module.exports = function (object, property) { - var initialValue = object[property]; + var initialValue = object[property]; - // Providing options? - if (common.isArray(arguments[2]) || common.isObject(arguments[2])) { - return new OptionController(object, property, arguments[2]); - } - - // Providing a map? - - if (common.isNumber(initialValue)) { - - if (common.isNumber(arguments[2]) && common.isNumber(arguments[3])) { - // Has min and max. - return new NumberControllerSlider(object, property, arguments[2], arguments[3]); - - } else { - - return new NumberControllerBox(object, property, { min: arguments[2], max: arguments[3] }); + // Providing options? + if (common.isArray(arguments[2]) || common.isObject(arguments[2])) { + return new OptionController(object, property, arguments[2]); } - } - if (common.isString(initialValue)) { - return new StringController(object, property); - } + // Providing a map? - if (common.isFunction(initialValue)) { - return new FunctionController(object, property, ''); - } + if (common.isNumber(initialValue)) { + + if (common.isNumber(arguments[2]) && common.isNumber(arguments[3])) { + + // Has min and max. + if (common.isNumber(arguments[4])) // has step + return new NumberControllerSlider(object, property, arguments[2], arguments[3], arguments[4]); + else + return new NumberControllerSlider(object, property, arguments[2], arguments[3]); + + } else { + + return new NumberControllerBox(object, property, {min: arguments[2], max: arguments[3]}); + + } + + } + + if (common.isString(initialValue)) { + return new StringController(object, property); + } + + if (common.isFunction(initialValue)) { + return new FunctionController(object, property, ''); + } + + if (common.isBoolean(initialValue)) { + return new BooleanController(object, property); + } - if (common.isBoolean(initialValue)) { - return new BooleanController(object, property); - } }; \ No newline at end of file