2015-02-04 23:52:56 +00:00
/ * *
* dat - gui JavaScript Controller Library
* http : //code.google.com/p/dat-gui
*
* Copyright 2011 Data Arts Team , Google Creative Lab
*
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
* You may obtain a copy of the License at
*
* 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 ( f , a ) { a = a || document ; var d = a . createElement ( "link" ) ; d . type = "text/css" ; d . rel = "stylesheet" ; d . href = f ; a . getElementsByTagName ( "head" ) [ 0 ] . appendChild ( d ) } , inject : function ( f , a ) { a = a || document ; var d = document . createElement ( "style" ) ; d . type = "text/css" ; d . innerHTML = f ; a . getElementsByTagName ( "head" ) [ 0 ] . appendChild ( d ) } } } ( ) ;
dat . utils . common = function ( ) { var f = Array . prototype . forEach , a = Array . prototype . slice ; return { BREAK : { } , extend : function ( d ) { this . each ( a . call ( arguments , 1 ) , function ( a ) { for ( var c in a ) this . isUndefined ( a [ c ] ) || ( d [ c ] = a [ c ] ) } , this ) ; return d } , defaults : function ( d ) { this . each ( a . call ( arguments , 1 ) , function ( a ) { for ( var c in a ) this . isUndefined ( d [ c ] ) && ( d [ c ] = a [ c ] ) } , this ) ; return d } , compose : function ( ) { var d = a . call ( arguments ) ; return function ( ) { for ( var e = a . call ( arguments ) , c = d . length - 1 ; 0 <= c ; c -- ) e = [ d [ c ] . apply ( this , e ) ] ; return e [ 0 ] } } ,
each : function ( a , e , c ) { if ( a ) if ( f && a . forEach && a . forEach === f ) a . forEach ( e , c ) ; else if ( a . length === a . length + 0 ) for ( var b = 0 , p = a . length ; b < p && ! ( b in a && e . call ( c , a [ b ] , b ) === this . BREAK ) ; b ++ ) ; else for ( b in a ) if ( e . call ( c , a [ b ] , b ) === this . BREAK ) break } , defer : function ( a ) { setTimeout ( a , 0 ) } , toArray : function ( d ) { return d . toArray ? d . toArray ( ) : a . call ( d ) } , isUndefined : function ( a ) { return void 0 === a } , isNull : function ( a ) { return null === a } , isNaN : function ( a ) { return a !== a } , isArray : Array . isArray || function ( a ) { return a . constructor === Array } ,
isObject : function ( a ) { return a === Object ( a ) } , isNumber : function ( a ) { return a === a + 0 } , isString : function ( a ) { return a === a + "" } , isBoolean : function ( a ) { return ! 1 === a || ! 0 === a } , isFunction : function ( a ) { return "[object Function]" === Object . prototype . toString . call ( a ) } } } ( ) ;
dat . controllers . Controller = function ( f ) { var a = function ( a , e ) { this . initialValue = a [ e ] ; this . domElement = document . createElement ( "div" ) ; this . object = a ; this . property = e ; this . _ _onFinishChange = this . _ _onChange = void 0 } ; f . extend ( a . prototype , { onChange : function ( a ) { this . _ _onChange = a ; return this } , onFinishChange : function ( a ) { this . _ _onFinishChange = a ; return this } , setValue : function ( a ) { this . object [ this . property ] = a ; this . _ _onChange && this . _ _onChange . call ( this , a ) ; this . updateDisplay ( ) ; return this } , getValue : function ( ) { return this . object [ this . property ] } ,
2013-12-18 23:27:02 +00:00
updateDisplay : function ( ) { return this } , isModified : function ( ) { return this . initialValue !== this . getValue ( ) } } ) ; return a } ( dat . utils . common ) ;
2015-02-04 23:52:56 +00:00
dat . dom . dom = function ( f ) { function a ( b ) { if ( "0" === b || f . isUndefined ( b ) ) return 0 ; b = b . match ( e ) ; return f . isNull ( b ) ? 0 : parseFloat ( b [ 1 ] ) } var d = { } ; f . each ( { HTMLEvents : [ "change" ] , MouseEvents : [ "click" , "mousemove" , "mousedown" , "mouseup" , "mouseover" ] , KeyboardEvents : [ "keydown" ] } , function ( b , a ) { f . each ( b , function ( b ) { d [ b ] = a } ) } ) ; var e = /(\d+(\.\d+)?)px/ , c = { 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 , c ) { f . isUndefined ( a ) && ( a = ! 0 ) ; f . isUndefined ( c ) && ( c = ! 0 ) ; b . style . position = "absolute" ; a && ( b . style . left = 0 , b . style . right = 0 ) ; c && ( b . style . top = 0 , b . style . bottom = 0 ) } , fakeEvent : function ( b , a , c , e ) { c = c || { } ; var r = d [ a ] ; if ( ! r ) throw Error ( "Event type " + a + " not supported." ) ; var n = document . createEvent ( r ) ; switch ( r ) { case "MouseEvents" : n . initMouseEvent ( a , c . bubbles || ! 1 , c . cancelable || ! 0 , window , c . clickCount || 1 , 0 , 0 , c . x || c . clientX || 0 , c . y || c . clientY || 0 , ! 1 ,
! 1 , ! 1 , ! 1 , 0 , null ) ; break ; case "KeyboardEvents" : r = n . initKeyboardEvent || n . initKeyEvent ; f . defaults ( c , { cancelable : ! 0 , ctrlKey : ! 1 , altKey : ! 1 , shiftKey : ! 1 , metaKey : ! 1 , keyCode : void 0 , charCode : void 0 } ) ; r ( a , c . bubbles || ! 1 , c . cancelable , window , c . ctrlKey , c . altKey , c . shiftKey , c . metaKey , c . keyCode , c . charCode ) ; break ; default : n . initEvent ( a , c . bubbles || ! 1 , c . cancelable || ! 0 ) } f . defaults ( n , e ) ; b . dispatchEvent ( n ) } , bind : function ( a , e , d , f ) { a . addEventListener ? a . addEventListener ( e , d , f || ! 1 ) : a . attachEvent && a . attachEvent ( "on" + e , d ) ; return c } ,
unbind : function ( a , e , d , f ) { a . removeEventListener ? a . removeEventListener ( e , d , f || ! 1 ) : a . detachEvent && a . detachEvent ( "on" + e , d ) ; return c } , addClass : function ( a , e ) { if ( void 0 === a . className ) a . className = e ; else if ( a . className !== e ) { var d = a . className . split ( / +/ ) ; - 1 == d . indexOf ( e ) && ( d . push ( e ) , a . className = d . join ( " " ) . replace ( /^\s+/ , "" ) . replace ( /\s+$/ , "" ) ) } return c } , removeClass : function ( a , e ) { if ( e ) { if ( void 0 !== a . className ) if ( a . className === e ) a . removeAttribute ( "class" ) ; else { var d = a . className . split ( / +/ ) , f = d . indexOf ( e ) ; - 1 !=
f && ( d . splice ( f , 1 ) , a . className = d . join ( " " ) ) } } else a . className = void 0 ; return c } , hasClass : function ( a , c ) { return ( new RegExp ( "(?:^|\\s+)" + c + "(?:\\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 c =
{ left : 0 , top : 0 } ; if ( a . offsetParent ) { do c . left += a . offsetLeft , c . top += a . offsetTop ; while ( a = a . offsetParent ) } return c } , isActive : function ( a ) { return a === document . activeElement && ( a . type || a . href ) } } ; return c } ( dat . utils . common ) ;
dat . controllers . OptionController = function ( f , a , d ) { var e = function ( c , b , f ) { e . superclass . call ( this , c , b ) ; var q = this ; this . _ _select = document . createElement ( "select" ) ; if ( d . isArray ( f ) ) { var l = { } ; d . each ( f , function ( a ) { l [ a ] = a } ) ; f = l } d . each ( f , function ( a , b ) { var c = document . createElement ( "option" ) ; c . innerHTML = b ; c . setAttribute ( "value" , a ) ; q . _ _select . appendChild ( c ) } ) ; this . updateDisplay ( ) ; a . bind ( this . _ _select , "change" , function ( ) { q . setValue ( this . options [ this . selectedIndex ] . value ) } ) ; this . domElement . appendChild ( this . _ _select ) } ;
e . superclass = f ; d . extend ( e . prototype , f . prototype , { setValue : function ( a ) { a = e . superclass . prototype . setValue . call ( this , a ) ; this . _ _onFinishChange && this . _ _onFinishChange . call ( this , this . getValue ( ) ) ; return a } , updateDisplay : function ( ) { this . _ _select . value = this . getValue ( ) ; return e . superclass . prototype . updateDisplay . call ( this ) } } ) ; return e } ( dat . controllers . Controller , dat . dom . dom , dat . utils . common ) ;
2015-06-03 18:47:13 +00:00
dat . controllers . NumberController = function ( f , a ) { function d ( a ) { a = a . toString ( ) ; return - 1 < a . indexOf ( "." ) ? a . length - a . indexOf ( "." ) - 1 : 0 } var e = function ( c , b , f ) { e . superclass . call ( this , c , b ) ; f = f || { } ; this . _ _min = f . min ; this . _ _max = f . max ; this . _ _step = f . step ; a . isUndefined ( this . _ _step ) ? this . _ _impliedStep = 0 == this . initialValue ? 1 : Math . pow ( 10 , Math . floor ( Math . log ( Math . abs ( this . initialValue ) ) / Math . LN10 ) ) / 10 : this . _ _impliedStep = this . _ _step ; this . _ _precision = d ( this . _ _impliedStep ) } ; e . superclass = f ; a . extend ( e . prototype , f . prototype ,
{ setValue : function ( a ) { void 0 !== this . _ _min && a < this . _ _min ? a = this . _ _min : void 0 !== this . _ _max && a > this . _ _max && ( a = this . _ _max ) ; void 0 !== this . _ _step && 0 != a % this . _ _step && ( a = Math . round ( a / this . _ _step ) * this . _ _step ) ; return e . 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 = d ( a ) ; return this } } ) ; return e } ( dat . controllers . Controller , dat . utils . common ) ;
2015-02-04 23:52:56 +00:00
dat . controllers . NumberControllerBox = function ( f , a , d ) { var e = function ( c , b , f ) { function q ( ) { var a = parseFloat ( n . _ _input . value ) ; d . isNaN ( a ) || n . setValue ( a ) } function l ( a ) { var b = u - a . clientY ; n . setValue ( n . getValue ( ) + b * n . _ _impliedStep ) ; u = a . clientY } function r ( ) { a . unbind ( window , "mousemove" , l ) ; a . unbind ( window , "mouseup" , r ) } this . _ _truncationSuspended = ! 1 ; e . superclass . call ( this , c , b , f ) ; var n = this , u ; this . _ _input = document . createElement ( "input" ) ; this . _ _input . setAttribute ( "type" , "text" ) ; a . bind ( this . _ _input , "change" , q ) ; a . bind ( this . _ _input ,
"blur" , function ( ) { q ( ) ; n . _ _onFinishChange && n . _ _onFinishChange . call ( n , n . getValue ( ) ) } ) ; a . bind ( this . _ _input , "mousedown" , function ( b ) { a . bind ( window , "mousemove" , l ) ; a . bind ( window , "mouseup" , r ) ; u = b . 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 ) } ; e . superclass = f ; d . extend ( e . prototype , f . prototype , { updateDisplay : function ( ) { var a = this . _ _input , b ; if ( this . _ _truncationSuspended ) b =
this . getValue ( ) ; else { b = this . getValue ( ) ; var d = Math . pow ( 10 , this . _ _precision ) ; b = Math . round ( b * d ) / d } a . value = b ; return e . superclass . prototype . updateDisplay . call ( this ) } } ) ; return e } ( dat . controllers . NumberController , dat . dom . dom , dat . utils . common ) ;
dat . controllers . NumberControllerSlider = function ( f , a , d , e , c ) { function b ( a , b , c , e , d ) { return e + ( a - b ) / ( c - b ) * ( d - e ) } var p = function ( c , e , d , f , u ) { function A ( c ) { c . preventDefault ( ) ; var e = a . getOffset ( k . _ _background ) , d = a . getWidth ( k . _ _background ) ; k . setValue ( b ( c . clientX , e . left , e . left + d , k . _ _min , k . _ _max ) ) ; return ! 1 } function g ( ) { a . unbind ( window , "mousemove" , A ) ; a . unbind ( window , "mouseup" , g ) ; k . _ _onFinishChange && k . _ _onFinishChange . call ( k , k . getValue ( ) ) } p . superclass . call ( this , c , e , { min : d , max : f , step : u } ) ; var k = this ; this . _ _background =
document . createElement ( "div" ) ; this . _ _foreground = document . createElement ( "div" ) ; a . bind ( this . _ _background , "mousedown" , function ( b ) { a . bind ( window , "mousemove" , A ) ; a . bind ( window , "mouseup" , g ) ; A ( b ) } ) ; a . addClass ( this . _ _background , "slider" ) ; a . addClass ( this . _ _foreground , "slider-fg" ) ; this . updateDisplay ( ) ; this . _ _background . appendChild ( this . _ _foreground ) ; this . domElement . appendChild ( this . _ _background ) } ; p . superclass = f ; p . useDefaultStyles = function ( ) { d . inject ( c ) } ; e . extend ( p . prototype , f . prototype , { updateDisplay : function ( ) { var a =
2013-12-18 23:27:02 +00:00
( this . getValue ( ) - this . _ _min ) / ( this . _ _max - this . _ _min ) ; this . _ _foreground . style . width = 100 * a + "%" ; return p . superclass . prototype . updateDisplay . call ( this ) } } ) ; return p } ( 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}" ) ;
2015-02-04 23:52:56 +00:00
dat . controllers . FunctionController = function ( f , a , d ) { var e = function ( c , b , d ) { e . superclass . call ( this , c , b ) ; var f = this ; this . _ _button = document . createElement ( "div" ) ; this . _ _button . innerHTML = void 0 === d ? "Fire" : d ; a . bind ( this . _ _button , "click" , function ( a ) { a . preventDefault ( ) ; f . fire ( ) ; return ! 1 } ) ; a . addClass ( this . _ _button , "button" ) ; this . domElement . appendChild ( this . _ _button ) } ; e . superclass = f ; d . extend ( e . 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 e } ( dat . controllers . Controller , dat . dom . dom , dat . utils . common ) ;
dat . controllers . BooleanController = function ( f , a , d ) { var e = function ( c , b ) { e . superclass . call ( this , c , b ) ; 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 ( ) } ; e . superclass = f ; d . extend ( e . prototype , f . prototype , { setValue : function ( a ) { a = e . 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 e . superclass . prototype . updateDisplay . call ( this ) } } ) ; return e } ( 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 d , e , c = [ { 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 ( ) { e = ! 1 ;
var b = 1 < arguments . length ? a . toArray ( arguments ) : arguments [ 0 ] ; a . each ( c , function ( c ) { if ( c . litmus ( b ) ) return a . each ( c . conversions , function ( c , f ) { d = c . read ( b ) ; if ( ! 1 === e && ! 1 !== d ) return e = d , d . conversionName = f , d . conversion = c , a . BREAK } ) , a . BREAK } ) ; return e } } ( dat . color . toString , dat . utils . common ) ;
dat . GUI = dat . gui . GUI = function ( f , a , d , e , c , b , p , q , l , r , n , u , A , g , k ) { function v ( a , b , h , d ) { if ( void 0 === b [ h ] ) throw Error ( "Object " + b + ' has no property "' + h + '"' ) ; d . color ? b = new n ( b , h ) : ( b = [ b , h ] . concat ( d . factoryArgs ) , b = e . apply ( a , b ) ) ; d . before instanceof c && ( d . before = d . before . _ _li ) ; y ( a , b ) ; g . addClass ( b . domElement , "c" ) ; h = document . createElement ( "span" ) ; g . addClass ( h , "property-name" ) ; h . innerHTML = b . property ; var f = document . createElement ( "div" ) ; f . appendChild ( h ) ; f . appendChild ( b . domElement ) ; d = w ( a , f , d . before ) ; g . addClass ( d , m . CLASS _CONTROLLER _ROW ) ;
g . addClass ( d , typeof b . getValue ( ) ) ; t ( a , d , b ) ; a . _ _controllers . push ( b ) ; return b } function w ( a , b , h ) { var c = document . createElement ( "li" ) ; b && c . appendChild ( b ) ; h ? a . _ _ul . insertBefore ( c , params . before ) : a . _ _ul . appendChild ( c ) ; a . onResize ( ) ; return c } function t ( a , c , h ) { h . _ _li = c ; h . _ _gui = a ; k . extend ( h , { options : function ( b ) { if ( 1 < arguments . length ) return h . remove ( ) , v ( a , h . object , h . property , { before : h . _ _li . nextElementSibling , factoryArgs : [ k . toArray ( arguments ) ] } ) ; if ( k . isArray ( b ) || k . isObject ( b ) ) return h . remove ( ) , v ( a , h . object , h . property ,
2015-12-01 21:37:07 +00:00
{ before : h . _ _li . nextElementSibling , factoryArgs : [ b ] } ) } , name : function ( a ) { h . _ _li . firstElementChild . firstElementChild . innerHTML = a ; return h } , listen : function ( ) { h . _ _gui . listen ( h ) ; return h } , remove : function ( ) { h . _ _gui . remove ( h ) ; return h } } ) ; if ( h instanceof l ) { var d = new q ( h . object , h . property , { min : h . _ _min , max : h . _ _max , step : h . _ _step } ) ; k . each ( [ "updateDisplay" , "onChange" , "onFinishChange" ] , function ( a ) { var H = h [ a ] , b = d [ a ] ; h [ a ] = d [ a ] = function ( ) { var a = Array . prototype . slice . call ( arguments ) ; H . apply ( h , a ) ; return b . apply ( d , a ) } } ) ;
2015-02-04 23:52:56 +00:00
g . addClass ( c , "has-slider" ) ; h . domElement . insertBefore ( d . domElement , h . domElement . firstElementChild ) } else if ( h instanceof q ) { var e = function ( b ) { return k . isNumber ( h . _ _min ) && k . isNumber ( h . _ _max ) ? ( h . remove ( ) , v ( a , h . object , h . property , { before : h . _ _li . nextElementSibling , factoryArgs : [ h . _ _min , h . _ _max , h . _ _step ] } ) ) : b } ; h . min = k . compose ( e , h . min ) ; h . max = k . compose ( e , h . max ) } else h instanceof b ? ( g . bind ( c , "click" , function ( ) { g . fakeEvent ( h . _ _checkbox , "click" ) } ) , g . bind ( h . _ _checkbox , "click" , function ( a ) { a . stopPropagation ( ) } ) ) :
h instanceof p ? ( g . bind ( c , "click" , function ( ) { g . fakeEvent ( h . _ _button , "click" ) } ) , g . bind ( c , "mouseover" , function ( ) { g . addClass ( h . _ _button , "hover" ) } ) , g . bind ( c , "mouseout" , function ( ) { g . removeClass ( h . _ _button , "hover" ) } ) ) : h instanceof n && ( g . addClass ( c , "color" ) , h . updateDisplay = k . compose ( function ( a ) { c . style . borderLeftColor = h . _ _color . toString ( ) ; return a } , h . updateDisplay ) , h . updateDisplay ( ) ) ; h . setValue = k . compose ( function ( b ) { a . getRoot ( ) . _ _preset _select && h . isModified ( ) && E ( a . getRoot ( ) , ! 0 ) ; return b } , h . setValue ) } function y ( a ,
2015-12-01 21:47:47 +00:00
b ) { var c = a . getRoot ( ) , d = c . _ _rememberedObjects . indexOf ( b . object ) ; if ( - 1 != d ) { var e = c . _ _rememberedObjectIndecesToControllers [ d ] ; void 0 === e && ( e = { } , c . _ _rememberedObjectIndecesToControllers [ d ] = e ) ; e [ b . property ] = b ; if ( c . load && c . load . remembered ) { c = c . load . remembered ; if ( c [ a . preset ] ) c = c [ a . preset ] ; else if ( c . Default ) c = c . Default ; else return ; c [ d ] && void 0 !== c [ d ] [ b . property ] && ( d = c [ d ] [ b . property ] , b . initialValue = d , b . setValue ( d ) ) } } } function L ( a ) { var b = a . _ _save _row = document . createElement ( "li" ) ; g . addClass ( a . domElement , "has-save" ) ;
2015-02-04 23:52:56 +00:00
a . _ _ul . insertBefore ( b , a . _ _ul . firstChild ) ; g . addClass ( b , "save-row" ) ; var c = document . createElement ( "span" ) ; c . innerHTML = " " ; g . addClass ( c , "button gears" ) ; var d = document . createElement ( "span" ) ; d . innerHTML = "Save" ; g . addClass ( d , "button" ) ; g . addClass ( d , "save" ) ; var e = document . createElement ( "span" ) ; e . innerHTML = "New" ; g . addClass ( e , "button" ) ; g . addClass ( e , "save-as" ) ; var f = document . createElement ( "span" ) ; f . innerHTML = "Revert" ; g . addClass ( f , "button" ) ; g . addClass ( f , "revert" ) ; var r = a . _ _preset _select = document . createElement ( "select" ) ;
a . load && a . load . remembered ? k . each ( a . load . remembered , function ( b , c ) { F ( a , c , c == a . preset ) } ) : F ( a , "Default" , ! 1 ) ; g . bind ( r , "change" , function ( ) { for ( var b = 0 ; b < a . _ _preset _select . length ; b ++ ) a . _ _preset _select [ b ] . innerHTML = a . _ _preset _select [ b ] . value ; a . preset = this . value } ) ; b . appendChild ( r ) ; b . appendChild ( c ) ; b . appendChild ( d ) ; b . appendChild ( e ) ; b . appendChild ( f ) ; if ( x ) { var n = function ( ) { u . style . display = a . useLocalStorage ? "block" : "none" } , b = document . getElementById ( "dg-save-locally" ) , u = document . getElementById ( "dg-local-explain" ) ;
b . style . display = "block" ; b = document . getElementById ( "dg-local-storage" ) ; "true" === localStorage . getItem ( document . location . href + ".isLocal" ) && b . setAttribute ( "checked" , "checked" ) ; n ( ) ; g . bind ( b , "change" , function ( ) { a . useLocalStorage = ! a . useLocalStorage ; n ( ) } ) } var m = document . getElementById ( "dg-new-constructor" ) ; g . bind ( m , "keydown" , function ( a ) { ! a . metaKey || 67 !== a . which && 67 != a . keyCode || B . hide ( ) } ) ; g . bind ( c , "click" , function ( ) { m . innerHTML = JSON . stringify ( a . getSaveObject ( ) , void 0 , 2 ) ; B . show ( ) ; m . focus ( ) ; m . select ( ) } ) ; g . bind ( d ,
2015-12-01 21:47:47 +00:00
"click" , function ( ) { a . save ( ) } ) ; g . bind ( e , "click" , function ( ) { var b = prompt ( "Enter a new preset name." ) ; b && a . saveAs ( b ) } ) ; g . bind ( f , "click" , function ( ) { a . revert ( ) } ) } function M ( a ) { function b ( f ) { f . preventDefault ( ) ; e = f . clientX ; g . addClass ( a . _ _closeButton , m . CLASS _DRAG ) ; g . bind ( window , "mousemove" , c ) ; g . bind ( window , "mouseup" , d ) ; return ! 1 } function c ( b ) { b . preventDefault ( ) ; a . width += e - b . clientX ; a . onResize ( ) ; e = b . clientX ; return ! 1 } function d ( ) { g . removeClass ( a . _ _closeButton , m . CLASS _DRAG ) ; g . unbind ( window , "mousemove" , c ) ; g . unbind ( window ,
2015-02-04 23:52:56 +00:00
"mouseup" , d ) } a . _ _resize _handle = document . createElement ( "div" ) ; k . extend ( a . _ _resize _handle . style , { width : "6px" , marginLeft : "-3px" , height : "200px" , cursor : "ew-resize" , position : "absolute" } ) ; var e ; g . bind ( a . _ _resize _handle , "mousedown" , b ) ; g . bind ( a . _ _closeButton , "mousedown" , b ) ; a . domElement . insertBefore ( a . _ _resize _handle , a . domElement . firstElementChild ) } function G ( a , b ) { a . domElement . style . width = b + "px" ; a . _ _save _row && a . autoPlace && ( a . _ _save _row . style . width = b + "px" ) ; a . _ _closeButton && ( a . _ _closeButton . style . width = b + "px" ) }
2015-12-01 21:37:07 +00:00
function C ( a , b ) { var c = { } ; k . each ( a . _ _rememberedObjects , function ( d , e ) { var f = { } ; k . each ( a . _ _rememberedObjectIndecesToControllers [ e ] , function ( a , c ) { f [ c ] = b ? a . initialValue : a . getValue ( ) } ) ; c [ e ] = f } ) ; return c } function F ( a , b , c ) { var d = document . createElement ( "option" ) ; d . innerHTML = b ; d . value = b ; a . _ _preset _select . appendChild ( d ) ; c && ( a . _ _preset _select . selectedIndex = a . _ _preset _select . length - 1 ) } function E ( a , b ) { var c = a . _ _preset _select [ a . _ _preset _select . selectedIndex ] ; c . innerHTML = b ? c . value + "*" : c . value } function I ( a ) { 0 != a . length &&
u ( function ( ) { I ( a ) } ) ; k . each ( a , function ( a ) { a . updateDisplay ( ) } ) } f . inject ( d ) ; var x ; try { x = "localStorage" in window && null !== window . localStorage } catch ( H ) { x = ! 1 } var B , J = ! 0 , z , D = ! 1 , K = [ ] , m = function ( a ) { function b ( ) { var a = c . getRoot ( ) ; a . width += 1 ; k . defer ( function ( ) { -- a . width } ) } var c = this ; this . domElement = document . createElement ( "div" ) ; this . _ _ul = document . createElement ( "ul" ) ; this . domElement . appendChild ( this . _ _ul ) ; g . addClass ( this . domElement , "dg" ) ; this . _ _folders = { } ; this . _ _controllers = [ ] ; this . _ _rememberedObjects = [ ] ; this . _ _rememberedObjectIndecesToControllers =
[ ] ; this . _ _listening = [ ] ; a = a || { } ; a = k . defaults ( a , { autoPlace : ! 0 , width : m . DEFAULT _WIDTH } ) ; a = k . defaults ( a , { resizable : a . autoPlace , hideable : a . autoPlace } ) ; k . isUndefined ( a . load ) ? a . load = { preset : "Default" } : a . preset && ( a . load . preset = a . preset ) ; k . isUndefined ( a . parent ) && a . hideable && K . push ( this ) ; a . resizable = k . isUndefined ( a . parent ) && a . resizable ; a . autoPlace && k . isUndefined ( a . scrollable ) && ( a . scrollable = ! 0 ) ; var d = x && "true" === localStorage . getItem ( document . location . href + ".isLocal" ) , e ; Object . defineProperties ( this , { parent : { get : function ( ) { return a . parent } } ,
2015-02-04 23:52:56 +00:00
scrollable : { get : function ( ) { return a . scrollable } } , autoPlace : { get : function ( ) { return a . autoPlace } } , preset : { get : function ( ) { return c . parent ? c . getRoot ( ) . preset : a . load . preset } , set : function ( b ) { c . parent ? c . getRoot ( ) . preset = b : a . load . preset = b ; for ( b = 0 ; b < this . _ _preset _select . length ; b ++ ) this . _ _preset _select [ b ] . value == this . preset && ( this . _ _preset _select . selectedIndex = b ) ; c . revert ( ) } } , width : { get : function ( ) { return a . width } , set : function ( b ) { a . width = b ; G ( c , b ) } } , name : { get : function ( ) { return a . name } , set : function ( b ) { a . name =
b ; r && ( r . innerHTML = a . name ) } } , closed : { get : function ( ) { return a . closed } , set : function ( b ) { a . closed = b ; a . closed ? g . addClass ( c . _ _ul , m . CLASS _CLOSED ) : g . removeClass ( c . _ _ul , m . CLASS _CLOSED ) ; this . onResize ( ) ; c . _ _closeButton && ( c . _ _closeButton . innerHTML = b ? m . TEXT _OPEN : m . TEXT _CLOSED ) } } , load : { get : function ( ) { return a . load } } , useLocalStorage : { get : function ( ) { return d } , set : function ( a ) { x && ( ( d = a ) ? g . bind ( window , "unload" , e ) : g . unbind ( window , "unload" , e ) , localStorage . setItem ( document . location . href + ".isLocal" , a ) ) } } } ) ; if ( k . isUndefined ( a . parent ) ) { a . closed =
! 1 ; g . addClass ( this . domElement , m . CLASS _MAIN ) ; g . makeSelectable ( this . domElement , ! 1 ) ; if ( x && d ) { c . useLocalStorage = ! 0 ; var f = localStorage . getItem ( document . location . href + ".gui" ) ; f && ( a . load = JSON . parse ( f ) ) } this . _ _closeButton = document . createElement ( "div" ) ; this . _ _closeButton . innerHTML = m . TEXT _CLOSED ; g . addClass ( this . _ _closeButton , m . CLASS _CLOSE _BUTTON ) ; this . domElement . appendChild ( this . _ _closeButton ) ; g . bind ( this . _ _closeButton , "click" , function ( ) { c . closed = ! c . closed } ) } else { void 0 === a . closed && ( a . closed = ! 0 ) ; var r = document . createTextNode ( a . name ) ;
2015-12-01 21:47:47 +00:00
g . addClass ( r , "controller-name" ) ; f = w ( c , r ) ; g . addClass ( this . _ _ul , m . CLASS _CLOSED ) ; g . addClass ( f , "title" ) ; g . bind ( f , "click" , function ( a ) { a . preventDefault ( ) ; c . closed = ! c . closed ; return ! 1 } ) ; a . closed || ( this . closed = ! 1 ) } a . autoPlace && ( k . isUndefined ( a . parent ) && ( J && ( z = document . createElement ( "div" ) , g . addClass ( z , "dg" ) , g . addClass ( z , m . CLASS _AUTO _PLACE _CONTAINER ) , document . body . appendChild ( z ) , J = ! 1 ) , z . appendChild ( this . domElement ) , g . addClass ( this . domElement , m . CLASS _AUTO _PLACE ) ) , this . parent || G ( c , a . width ) ) ; this . _resizeHandler =
function ( ) { c . onResize ( ) } ; g . bind ( window , "resize" , this . _resizeHandler ) ; g . bind ( this . _ _ul , "webkitTransitionEnd" , this . _resizeHandler ) ; g . bind ( this . _ _ul , "transitionend" , this . _resizeHandler ) ; g . bind ( this . _ _ul , "oTransitionEnd" , this . _resizeHandler ) ; this . onResize ( ) ; a . resizable && M ( this ) ; this . saveToLocalStorageIfPossible = e = function ( ) { x && "true" === localStorage . getItem ( document . location . href + ".isLocal" ) && localStorage . setItem ( document . location . href + ".gui" , JSON . stringify ( c . getSaveObject ( ) ) ) } ; c . getRoot ( ) ; a . parent || b ( ) } ;
m . toggleHide = function ( ) { D = ! D ; k . each ( K , function ( a ) { a . domElement . style . zIndex = D ? - 999 : 999 ; a . domElement . style . opacity = D ? 0 : 1 } ) } ; m . CLASS _AUTO _PLACE = "a" ; m . CLASS _AUTO _PLACE _CONTAINER = "ac" ; m . CLASS _MAIN = "main" ; m . CLASS _CONTROLLER _ROW = "cr" ; m . CLASS _TOO _TALL = "taller-than-window" ; m . CLASS _CLOSED = "closed" ; m . CLASS _CLOSE _BUTTON = "close-button" ; m . CLASS _DRAG = "drag" ; m . DEFAULT _WIDTH = 245 ; m . TEXT _CLOSED = "Close Controls" ; m . TEXT _OPEN = "Open Controls" ; this . _keydownHandler = function ( a ) { "text" === document . activeElement . type || 72 !==
a . which && 72 != a . keyCode || m . toggleHide ( ) } ; g . bind ( window , "keydown" , this . _keydownHandler , ! 1 ) ; k . extend ( m . prototype , { add : function ( a , b ) { return v ( this , a , b , { factoryArgs : Array . prototype . slice . call ( arguments , 2 ) } ) } , addColor : function ( a , b ) { return v ( this , a , b , { color : ! 0 } ) } , remove : function ( a ) { this . _ _ul . removeChild ( a . _ _li ) ; this . _ _controllers . splice ( this . _ _controllers . indexOf ( a ) , 1 ) ; var b = this ; k . defer ( function ( ) { b . onResize ( ) } ) } , destroy : function ( ) { this . autoPlace && z . removeChild ( this . domElement ) ; g . unbind ( window , "keydown" ,
this . _keydownHandler , ! 1 ) ; g . unbind ( window , "resize" , this . _resizeHandler ) ; this . saveToLocalStorageIfPossible && g . unbind ( window , "unload" , this . saveToLocalStorageIfPossible ) } , addFolder : function ( a ) { if ( void 0 !== this . _ _folders [ a ] ) throw Error ( 'You already have a folder in this GUI by the name "' + a + '"' ) ; var b = { name : a , parent : this } ; b . autoPlace = this . autoPlace ; this . load && this . load . folders && this . load . folders [ a ] && ( b . closed = this . load . folders [ a ] . closed , b . load = this . load . folders [ a ] ) ; b = new m ( b ) ; this . _ _folders [ a ] = b ; a = w ( this ,
b . domElement ) ; g . addClass ( a , "folder" ) ; return b } , open : function ( ) { this . closed = ! 1 } , close : function ( ) { this . closed = ! 0 } , onResize : function ( ) { var a = this . getRoot ( ) ; if ( a . scrollable ) { var b = g . getOffset ( a . _ _ul ) . top , c = 0 ; k . each ( a . _ _ul . childNodes , function ( b ) { a . autoPlace && b === a . _ _save _row || ( c += g . getHeight ( b ) ) } ) ; window . innerHeight - b - 20 < c ? ( g . addClass ( a . domElement , m . CLASS _TOO _TALL ) , a . _ _ul . style . height = window . innerHeight - b - 20 + "px" ) : ( g . removeClass ( a . domElement , m . CLASS _TOO _TALL ) , a . _ _ul . style . height = "auto" ) } a . _ _resize _handle &&
k . defer ( function ( ) { a . _ _resize _handle . style . height = a . _ _ul . offsetHeight + "px" } ) ; a . _ _closeButton && ( a . _ _closeButton . style . width = a . width + "px" ) } , remember : function ( ) { k . isUndefined ( B ) && ( B = new A , B . domElement . innerHTML = a ) ; if ( this . parent ) throw Error ( "You can only call remember on a top level GUI." ) ; var b = this ; k . each ( Array . prototype . slice . call ( arguments ) , function ( a ) { 0 == b . _ _rememberedObjects . length && L ( b ) ; - 1 == b . _ _rememberedObjects . indexOf ( a ) && b . _ _rememberedObjects . push ( a ) } ) ; this . autoPlace && G ( this , this . width ) } , getRoot : function ( ) { for ( var a =
this ; a . parent ; ) a = a . parent ; return a } , getSaveObject : function ( ) { var a = this . load ; a . closed = this . closed ; 0 < this . _ _rememberedObjects . length && ( a . preset = this . preset , a . remembered || ( a . remembered = { } ) , a . remembered [ this . preset ] = C ( this ) ) ; a . folders = { } ; k . each ( this . _ _folders , function ( b , c ) { a . folders [ c ] = b . getSaveObject ( ) } ) ; return a } , save : function ( ) { this . load . remembered || ( this . load . remembered = { } ) ; this . load . remembered [ this . preset ] = C ( this ) ; E ( this , ! 1 ) ; this . saveToLocalStorageIfPossible ( ) } , saveAs : function ( a ) { this . load . remembered ||
( this . load . remembered = { } , this . load . remembered . Default = C ( this , ! 0 ) ) ; this . load . remembered [ a ] = C ( this ) ; this . preset = a ; F ( this , a , ! 0 ) ; this . saveToLocalStorageIfPossible ( ) } , revert : function ( a ) { k . each ( this . _ _controllers , function ( b ) { this . getRoot ( ) . load . remembered ? y ( a || this . getRoot ( ) , b ) : b . setValue ( b . initialValue ) } , this ) ; k . each ( this . _ _folders , function ( a ) { a . revert ( a ) } ) ; a || E ( this . getRoot ( ) , ! 1 ) } , listen : function ( a ) { var b = 0 == this . _ _listening . length ; this . _ _listening . push ( a ) ; b && I ( this . _ _listening ) } } ) ; return m } ( dat . utils . css ,
'<div id="dg-save" class="dg dialogue">\n\n Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n <textarea id="dg-new-constructor"></textarea>\n\n <div id="dg-save-locally">\n\n <input id="dg-local-storage" type="checkbox"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n \n </div>\n \n </div>\n\n</div>' ,
2013-12-18 23:58:13 +00:00
" . 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 . dg ul { \ n list - style : none ; \ n margin : 0 ; \ n padding : 0 ; \ n width : 100 % ; \ n clear : both ; } \ n . dg . ac { \ n position : fixed ; \ n top : 0 ; \ n left : 0 ; \ n right : 0 ; \ n height : 0 ; \ n z - index : 0 ; } \ n . dg : not ( . ac ) . main { \ n /** Exclude mains in ac so that we don't hide close button */ \ n overflow : hidden ; } \ n . dg . main { \ n - webkit - transition : opacity 0.1 s linear ; \ n - o - transition : opacity 0.1 s linear ; \ n - moz - transition : opacity 0.1 s linear ; \ n transition : opacity 0.1 s linear ; } \ n . dg . main . taller - than - window { \ n overflow - y : auto ; } \ n . dg . main . taller - than - window . close - button { \ n opacity : 1 ; \ n /* TODO, these are style notes */ \ n margin - top : - 1 px ; \ n border - top : 1 px solid # 2 c2c2c ; } \ n . dg . main ul . closed . close - button { \ n opacity : 1 ! important ; } \ n . dg . main : hover . close - button , \ n . dg . main . close - button . drag { \ n opacity : 1 ; } \ n . dg . main . close - button { \ n /*opacity: 0;*/ \ n - webkit - transition : opacity 0.1 s linear ; \ n - o - transition : opacity 0.1 s linear ; \ n - moz - transition : opacity 0.1 s linear ; \ n transition : opacity 0.1 s linear ; \ n border : 0 ; \ n position : absolute ; \ n line - height : 19 px ; \ n height : 20 px ; \ n /* TODO, these are style notes */ \ n cursor : pointer ; \ n text - align : center ; \ n background - color : # 000 ; } \ n . dg . main . close - button : hover { \ n background - color : # 111 ; } \ n . dg . a { \ n float : right ; \ n margin - right : 15 px ; \ n overflow - x : hidden ; } \ n . dg . a . has - save > ul { \ n margin - top : 27 px ; } \ n . dg . a . has - save > ul . closed { \ n margin - top : 0 ; } \ n . dg . a . save - row { \ n position : fixed ; \ n top : 0 ; \ n z - index : 1002 ; } \ n . dg li { \ n - webkit - transition : height 0.1 s ease - out ; \ n - o - transition : height 0.1 s ease - out ; \ n - moz - transition : height 0.1 s ease - out ; \ n transition : height 0.1 s ease - out ; } \ n . dg li : not ( . folder ) { \ n cursor : auto ; \ n height : 27 px ; \ n line - height : 27 px ; \ n overflow : hidden ; \ n padding : 0 4 px 0 5 px ; } \ n . dg li . folder { \ n padding : 0 ; \ n border - left : 4 px solid rgba ( 0 , 0 , 0 , 0 ) ; } \ n . dg li . title { \ n cursor : pointer ; \ n margin - left : - 4 px ; } \ 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 . dg . cr { \ n clear : both ; \ n padding - left : 3 px ; \ n height : 27 px ; } \ n . dg . property - name { \ n cursor : default ; \ n float : left ; \ n clear : left ; \ n width : 40 % ; \ n overflow : hidden ; \ n text - overflow : ellipsis ; } \ n . dg . c { \ n float : left ; \ n width : 60 % ; } \ n . dg . c input [ type = text ] { \ n border : 0 ; \ n margin - top : 4 px ; \ n padding : 3 px ; \ n width : 100 % ; \ n float : right ; } \ n . dg . has - slider input [ type = text ] { \ n width : 30 % ; \ n /*display: none;*/ \ n margin - left : 0 ; } \ n . dg . slider { \ n float : left ; \ n width : 66 % ; \ n margin - left : - 5 px ; \ n margin - right : 0 ; \ n height : 19 px ; \ n margin - top : 4 px ; } \ n . dg . slider - fg { \ n height : 100 % ; } \ n . dg . c input [ type = checkbox ] { \ n margin - top : 9 px ; } \ n . dg . c select { \ n margin - top : 5 px ; } \ 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 . dg . selector { \ n display : none ; \ n position : absolute ; \ n margin - left : - 9 px ; \ n margin - top : 23 px ; \ n z - index : 10 ; } \ n . dg . c : hover . selector , \ n . dg . selector . drag { \ n display : block ; } \ n . dg li . save - row { \ n padding : 0 ; } \ n . dg li . save - row . button { \ n display : inline - block ; \ n padding : 0 px 6 px ; } \ n . dg . dialogue { \ n background - color : # 222 ; \ n wi
2015-02-04 23:52:56 +00:00
dat . controllers . factory = function ( f , a , d , e , c , b , p ) { return function ( q , l , r , n ) { var u = q [ l ] ; if ( p . isArray ( r ) || p . isObject ( r ) ) return new f ( q , l , r ) ; if ( p . isNumber ( u ) ) return p . isNumber ( r ) && p . isNumber ( n ) ? new d ( q , l , r , n ) : new a ( q , l , { min : r , max : n } ) ; if ( p . isString ( u ) ) return new e ( q , l ) ; if ( p . isFunction ( u ) ) return new c ( q , l , "" ) ; if ( p . isBoolean ( u ) ) return new b ( q , l ) } } ( dat . controllers . OptionController , dat . controllers . NumberControllerBox , dat . controllers . NumberControllerSlider , dat . controllers . StringController = function ( f , a , d ) { var e =
function ( c , b ) { function d ( ) { f . setValue ( f . _ _input . value ) } e . superclass . call ( this , c , b ) ; var f = this ; this . _ _input = document . createElement ( "input" ) ; this . _ _input . setAttribute ( "type" , "text" ) ; a . bind ( this . _ _input , "keyup" , d ) ; a . bind ( this . _ _input , "change" , d ) ; 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 ) } ; e . superclass = f ; d . extend ( e . prototype ,
f . prototype , { updateDisplay : function ( ) { a . isActive ( this . _ _input ) || ( this . _ _input . value = this . getValue ( ) ) ; return e . superclass . prototype . updateDisplay . call ( this ) } } ) ; return e } ( dat . controllers . Controller , dat . dom . dom , dat . utils . common ) , dat . controllers . FunctionController , dat . controllers . BooleanController , 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 , d , e , c ) { function b ( a , b , d , e ) { a . style . background = "" ; c . each ( l , function ( c ) { a . style . cssText += "background: " + c + "linear-gradient(" + b + ", " + d + " 0%, " + e + " 100%); " } ) } function p ( 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 q = function ( f , n ) { function u ( b ) { v ( b ) ; a . bind ( window , "mousemove" , v ) ; a . bind ( window ,
"mouseup" , l ) } function l ( ) { a . unbind ( window , "mousemove" , v ) ; a . unbind ( window , "mouseup" , l ) } function g ( ) { var a = e ( this . value ) ; ! 1 !== a ? ( t . _ _color . _ _state = a , t . setValue ( t . _ _color . toOriginal ( ) ) ) : this . value = t . _ _color . toString ( ) } function k ( ) { a . unbind ( window , "mousemove" , w ) ; a . unbind ( window , "mouseup" , k ) } function v ( 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 = 1 : 0 >
b && ( b = 0 ) ; 1 < e ? e = 1 : 0 > e && ( 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 ; 1 < b ? b = 1 : 0 > b && ( b = 0 ) ; t . _ _color . h = 360 * b ; t . setValue ( t . _ _color . toOriginal ( ) ) ; return ! 1 } q . superclass . call ( this , f , n ) ; this . _ _color = new d ( this . getValue ( ) ) ; this . _ _temp = new d ( 0 ) ; var t = this ; this . domElement = document . createElement ( "div" ) ; a . makeSelectable ( this . domElement , ! 1 ) ;
2013-12-18 23:27:02 +00:00
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" ) ;
2015-02-04 23:52:56 +00:00
this . _ _input . type = "text" ; this . _ _input _textShadow = "0 1px 1px " ; a . bind ( this . _ _input , "keydown" , function ( a ) { 13 === a . keyCode && g . call ( this ) } ) ; a . bind ( this . _ _input , "blur" , g ) ; a . bind ( this . _ _selector , "mousedown" , function ( b ) { a . addClass ( this , "drag" ) . bind ( window , "mouseup" , function ( b ) { a . removeClass ( t . _ _selector , "drag" ) } ) } ) ; var y = document . createElement ( "div" ) ; c . extend ( this . _ _selector . style , { width : "122px" , height : "102px" , padding : "3px" , backgroundColor : "#222" , boxShadow : "0px 1px 3px rgba(0,0,0,0.3)" } ) ; c . 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 } ) ; c . extend ( this . _ _hue _knob . style , { position : "absolute" , width : "15px" , height : "2px" , borderRight : "4px solid #fff" , zIndex : 1 } ) ; c . extend ( this . _ _saturation _field . style , { width : "100px" , height : "100px" , border : "1px solid #555" , marginRight : "3px" , display : "inline-block" , cursor : "pointer" } ) ; c . extend ( y . style , { width : "100%" , height : "100%" ,
background : "none" } ) ; b ( y , "top" , "rgba(0,0,0,0)" , "#000" ) ; c . extend ( this . _ _hue _field . style , { width : "15px" , height : "100px" , display : "inline-block" , border : "1px solid #555" , cursor : "ns-resize" } ) ; p ( this . _ _hue _field ) ; c . 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" , u ) ; a . bind ( this . _ _field _knob , "mousedown" , u ) ; a . bind ( this . _ _hue _field , "mousedown" , function ( b ) { w ( b ) ; a . bind ( window ,
"mousemove" , w ) ; a . bind ( window , "mouseup" , k ) } ) ; this . _ _saturation _field . appendChild ( y ) ; 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 ( ) } ; q . superclass = f ; c . extend ( q . prototype , f . prototype , { updateDisplay : function ( ) { var a = e ( this . getValue ( ) ) ; if ( ! 1 !== a ) { var f = ! 1 ;
c . each ( d . COMPONENTS , function ( b ) { if ( ! c . isUndefined ( a [ b ] ) && ! c . isUndefined ( this . _ _color . _ _state [ b ] ) && a [ b ] !== this . _ _color . _ _state [ b ] ) return f = ! 0 , { } } , this ) ; f && c . extend ( this . _ _color . _ _state , a ) } c . extend ( this . _ _temp . _ _state , this . _ _color . _ _state ) ; this . _ _temp . a = 1 ; var l = . 5 > this . _ _color . v || . 5 < this . _ _color . s ? 255 : 0 , p = 255 - l ; c . 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(" + l +
"," + l + "," + l + ")" } ) ; this . _ _hue _knob . style . marginTop = 100 * ( 1 - this . _ _color . h / 360 ) + "px" ; this . _ _temp . s = 1 ; this . _ _temp . v = 1 ; b ( this . _ _saturation _field , "left" , "#fff" , this . _ _temp . toString ( ) ) ; c . extend ( this . _ _input . style , { backgroundColor : this . _ _input . value = this . _ _color . toString ( ) , color : "rgb(" + l + "," + l + "," + l + ")" , textShadow : this . _ _input _textShadow + "rgba(" + p + "," + p + "," + p + ",.7)" } ) } } ) ; var l = [ "-moz-" , "-o-" , "-webkit-" , "-ms-" , "" ] ; return q } ( dat . controllers . Controller , dat . dom . dom , dat . color . Color = function ( f , a , d , e ) { function c ( a ,
b , c ) { Object . defineProperty ( a , b , { get : function ( ) { if ( "RGB" === this . _ _state . space ) return this . _ _state [ b ] ; p ( this , b , c ) ; return this . _ _state [ b ] } , set : function ( a ) { "RGB" !== this . _ _state . space && ( p ( this , b , c ) , this . _ _state . space = "RGB" ) ; this . _ _state [ b ] = a } } ) } function b ( a , b ) { Object . defineProperty ( a , b , { get : function ( ) { if ( "HSV" === this . _ _state . space ) return this . _ _state [ b ] ; q ( this ) ; return this . _ _state [ b ] } , set : function ( a ) { "HSV" !== this . _ _state . space && ( q ( this ) , this . _ _state . space = "HSV" ) ; this . _ _state [ b ] = a } } ) } function p ( b , c , d ) { if ( "HEX" ===
b . _ _state . space ) b . _ _state [ c ] = a . component _from _hex ( b . _ _state . hex , d ) ; else if ( "HSV" === b . _ _state . space ) e . extend ( b . _ _state , a . hsv _to _rgb ( b . _ _state . h , b . _ _state . s , b . _ _state . v ) ) ; else throw "Corrupted color state" ; } function q ( b ) { var c = a . rgb _to _hsv ( b . r , b . g , b . b ) ; e . extend ( b . _ _state , { s : c . s , v : c . v } ) ; e . isNaN ( c . h ) ? e . isUndefined ( b . _ _state . h ) && ( b . _ _state . h = 0 ) : b . _ _state . h = c . h } var l = function ( ) { this . _ _state = f . apply ( this , arguments ) ; if ( ! 1 === this . _ _state ) throw "Failed to interpret color arguments" ; this . _ _state . a = this . _ _state . a ||
1 } ; l . COMPONENTS = "r g b h s v hex a" . split ( " " ) ; e . extend ( l . prototype , { toString : function ( ) { return d ( this ) } , toOriginal : function ( ) { return this . _ _state . conversion . write ( this ) } } ) ; c ( l . prototype , "r" , 2 ) ; c ( l . prototype , "g" , 1 ) ; c ( l . prototype , "b" , 0 ) ; b ( l . prototype , "h" ) ; b ( l . prototype , "s" ) ; b ( l . prototype , "v" ) ; Object . defineProperty ( l . prototype , "a" , { get : function ( ) { return this . _ _state . a } , set : function ( a ) { this . _ _state . a = a } } ) ; Object . defineProperty ( l . prototype , "hex" , { get : function ( ) { "HEX" !== ! this . _ _state . space && ( this . _ _state . hex =
2015-12-01 21:37:07 +00:00
a . rgb _to _hex ( this . r , this . g , this . b ) ) ; return this . _ _state . hex } , set : function ( a ) { this . _ _state . space = "HEX" ; this . _ _state . hex = a } } ) ; return l } ( dat . color . interpret , dat . color . math = function ( ) { var f ; return { hsv _to _rgb : function ( a , d , e ) { var c = a / 60 - Math . floor ( a / 60 ) , b = e * ( 1 - d ) , f = e * ( 1 - c * d ) ; d = e * ( 1 - ( 1 - c ) * d ) ; a = [ [ e , d , b ] , [ f , e , b ] , [ b , e , d ] , [ b , f , e ] , [ d , b , e ] , [ e , b , f ] ] [ Math . floor ( a / 60 ) % 6 ] ; return { r : 255 * a [ 0 ] , g : 255 * a [ 1 ] , b : 255 * a [ 2 ] } } , rgb _to _hsv : function ( a , d , e ) { var c = Math . max ( a , d , e ) , b = c - Math . min ( a , d , e ) ; if ( 0 == c ) return { h : NaN , s : 0 , v : 0 } ; a =
( a == c ? ( d - e ) / b : d == c ? 2 + ( e - a ) / b : 4 + ( a - d ) / b ) / 6 ; 0 > a && ( a += 1 ) ; return { h : 360 * a , s : b / c , v : c / 255 } } , rgb _to _hex : function ( a , d , e ) { a = this . hex _with _component ( 0 , 2 , a ) ; a = this . hex _with _component ( a , 1 , d ) ; return a = this . hex _with _component ( a , 0 , e ) } , component _from _hex : function ( a , d ) { return a >> 8 * d & 255 } , hex _with _component : function ( a , d , e ) { return e << ( f = 8 * d ) | a & ~ ( 255 << f ) } } } ( ) , dat . color . toString , dat . utils . common ) , dat . color . interpret , dat . utils . common ) , dat . utils . requestAnimationFrame = function ( ) { return window . requestAnimationFrame || window . webkitRequestAnimationFrame ||
2015-02-04 23:52:56 +00:00
window . mozRequestAnimationFrame || window . oRequestAnimationFrame || window . msRequestAnimationFrame || function ( f , a ) { window . setTimeout ( f , 1E3 / 60 ) } } ( ) , dat . dom . CenteredDiv = function ( f , a ) { var d = function ( ) { this . backgroundElement = document . createElement ( "div" ) ; a . 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" } ) ; f . makeFullscreen ( this . backgroundElement ) ; this . backgroundElement . style . position =
"fixed" ; this . domElement = document . createElement ( "div" ) ; a . 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 d = this ; f . bind ( this . backgroundElement , "click" , function ( ) { d . hide ( ) } ) } ; d . prototype . show = function ( ) { var d = 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 ( ) ; a . defer ( function ( ) { d . backgroundElement . style . opacity = 1 ; d . domElement . style . opacity = 1 ; d . domElement . style . webkitTransform = "scale(1)" } ) } ; d . prototype . hide = function ( ) { var a = this , c = function ( ) { a . domElement . style . display = "none" ; a . backgroundElement . style . display = "none" ; f . unbind ( a . domElement , "webkitTransitionEnd" , c ) ; f . unbind ( a . domElement , "transitionend" , c ) ; f . unbind ( a . domElement ,
"oTransitionEnd" , c ) } ; f . bind ( this . domElement , "webkitTransitionEnd" , c ) ; f . bind ( this . domElement , "transitionend" , c ) ; f . bind ( this . domElement , "oTransitionEnd" , c ) ; this . backgroundElement . style . opacity = 0 ; this . domElement . style . opacity = 0 ; this . domElement . style . webkitTransform = "scale(1.1)" } ; d . prototype . layout = function ( ) { this . domElement . style . left = window . innerWidth / 2 - f . getWidth ( this . domElement ) / 2 + "px" ; this . domElement . style . top = window . innerHeight / 2 - f . getHeight ( this . domElement ) / 2 + "px" } ; return d } ( dat . dom . dom , dat . utils . common ) ,
dat . dom . dom , dat . utils . common ) ;