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