2013-12-18 23:27:02 +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 ( e , a ) { a = a || document ; var b = a . createElement ( "link" ) ; b . type = "text/css" ; b . rel = "stylesheet" ; b . href = e ; a . getElementsByTagName ( "head" ) [ 0 ] . appendChild ( b ) } , inject : function ( e , a ) { a = a || document ; var b = document . createElement ( "style" ) ; b . type = "text/css" ; b . innerHTML = e ; a . getElementsByTagName ( "head" ) [ 0 ] . appendChild ( b ) } } } ( ) ;
dat . utils . common = function ( ) { var e = Array . prototype . forEach , a = Array . prototype . slice ; return { BREAK : { } , extend : function ( b ) { this . each ( a . call ( arguments , 1 ) , function ( a ) { for ( var f in a ) this . isUndefined ( a [ f ] ) || ( b [ f ] = a [ f ] ) } , this ) ; return b } , defaults : function ( b ) { this . each ( a . call ( arguments , 1 ) , function ( a ) { for ( var f in a ) this . isUndefined ( b [ f ] ) && ( b [ f ] = a [ f ] ) } , this ) ; return b } , compose : function ( ) { var b = a . call ( arguments ) ; return function ( ) { for ( var d = a . call ( arguments ) , f = b . length - 1 ; 0 <= f ; f -- ) d = [ b [ f ] . apply ( this , d ) ] ; return d [ 0 ] } } ,
each : function ( a , d , f ) { if ( e && a . forEach === e ) a . forEach ( d , f ) ; else if ( a . length === a . length + 0 ) for ( var c = 0 , p = a . length ; c < p && ! ( c in a && d . call ( f , a [ c ] , c ) === this . BREAK ) ; c ++ ) ; else for ( c in a ) if ( d . call ( f , a [ c ] , c ) === this . BREAK ) break } , defer : function ( a ) { setTimeout ( a , 0 ) } , toArray : function ( b ) { return b . toArray ? b . toArray ( ) : a . call ( b ) } , 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 ( e ) { var a = function ( a , d ) { this . initialValue = a [ d ] ; this . domElement = document . createElement ( "div" ) ; this . object = a ; this . property = d ; this . _ _onFinishChange = this . _ _onChange = void 0 } ; e . 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 ] } ,
updateDisplay : function ( ) { return this } , isModified : function ( ) { return this . initialValue !== this . getValue ( ) } } ) ; return a } ( dat . utils . common ) ;
dat . dom . dom = function ( e ) { function a ( c ) { if ( "0" === c || e . isUndefined ( c ) ) return 0 ; c = c . match ( d ) ; return e . isNull ( c ) ? 0 : parseFloat ( c [ 1 ] ) } var b = { } ; e . each ( { HTMLEvents : [ "change" ] , MouseEvents : [ "click" , "mousemove" , "mousedown" , "mouseup" , "mouseover" ] , KeyboardEvents : [ "keydown" ] } , function ( c , a ) { e . each ( c , function ( c ) { b [ c ] = a } ) } ) ; var d = /(\d+(\.\d+)?)px/ , f = { makeSelectable : function ( c , a ) { void 0 !== c && void 0 !== c . style && ( c . onselectstart = a ? function ( ) { return ! 1 } : function ( ) { } , c . style . MozUserSelect = a ? "auto" : "none" , c . style . KhtmlUserSelect =
a ? "auto" : "none" , c . unselectable = a ? "on" : "off" ) } , makeFullscreen : function ( c , a , d ) { e . isUndefined ( a ) && ( a = ! 0 ) ; e . isUndefined ( d ) && ( d = ! 0 ) ; c . style . position = "absolute" ; a && ( c . style . left = 0 , c . style . right = 0 ) ; d && ( c . style . top = 0 , c . style . bottom = 0 ) } , fakeEvent : function ( c , a , d , f ) { d = d || { } ; var q = b [ a ] ; if ( ! q ) throw Error ( "Event type " + a + " not supported." ) ; var n = document . createEvent ( q ) ; switch ( q ) { case "MouseEvents" : n . initMouseEvent ( a , d . bubbles || ! 1 , d . cancelable || ! 0 , window , d . clickCount || 1 , 0 , 0 , d . x || d . clientX || 0 , d . y || d . clientY || 0 , ! 1 ,
! 1 , ! 1 , ! 1 , 0 , null ) ; break ; case "KeyboardEvents" : q = n . initKeyboardEvent || n . initKeyEvent ; e . defaults ( d , { cancelable : ! 0 , ctrlKey : ! 1 , altKey : ! 1 , shiftKey : ! 1 , metaKey : ! 1 , keyCode : void 0 , charCode : void 0 } ) ; q ( a , d . bubbles || ! 1 , d . cancelable , window , d . ctrlKey , d . altKey , d . shiftKey , d . metaKey , d . keyCode , d . charCode ) ; break ; default : n . initEvent ( a , d . bubbles || ! 1 , d . cancelable || ! 0 ) } e . defaults ( n , f ) ; c . dispatchEvent ( n ) } , bind : function ( c , a , d , b ) { c . addEventListener ? c . addEventListener ( a , d , b || ! 1 ) : c . attachEvent && c . attachEvent ( "on" + a , d ) ; return f } ,
unbind : function ( c , a , d , b ) { c . removeEventListener ? c . removeEventListener ( a , d , b || ! 1 ) : c . detachEvent && c . detachEvent ( "on" + a , d ) ; return f } , addClass : function ( a , d ) { if ( void 0 === a . className ) a . className = d ; else if ( a . className !== d ) { var b = a . className . split ( / +/ ) ; - 1 == b . indexOf ( d ) && ( b . push ( d ) , a . className = b . join ( " " ) . replace ( /^\s+/ , "" ) . replace ( /\s+$/ , "" ) ) } return f } , removeClass : function ( a , d ) { if ( d ) { if ( void 0 !== a . className ) if ( a . className === d ) a . removeAttribute ( "class" ) ; else { var b = a . className . split ( / +/ ) , e = b . indexOf ( d ) ; - 1 !=
e && ( b . splice ( e , 1 ) , a . className = b . join ( " " ) ) } } else a . className = void 0 ; return f } , hasClass : function ( a , d ) { return RegExp ( "(?:^|\\s+)" + d + "(?:\\s+|$)" ) . test ( a . className ) || ! 1 } , getWidth : function ( c ) { c = getComputedStyle ( c ) ; return a ( c [ "border-left-width" ] ) + a ( c [ "border-right-width" ] ) + a ( c [ "padding-left" ] ) + a ( c [ "padding-right" ] ) + a ( c . width ) } , getHeight : function ( c ) { c = getComputedStyle ( c ) ; return a ( c [ "border-top-width" ] ) + a ( c [ "border-bottom-width" ] ) + a ( c [ "padding-top" ] ) + a ( c [ "padding-bottom" ] ) + a ( c . height ) } , getOffset : function ( a ) { var d =
{ left : 0 , top : 0 } ; if ( a . offsetParent ) { do d . left += a . offsetLeft , d . top += a . offsetTop ; while ( a = a . offsetParent ) } return d } , isActive : function ( a ) { return a === document . activeElement && ( a . type || a . href ) } } ; return f } ( dat . utils . common ) ;
dat . controllers . OptionController = function ( e , a , b ) { var d = function ( f , c , e ) { d . superclass . call ( this , f , c ) ; var k = this ; this . _ _select = document . createElement ( "select" ) ; if ( b . isArray ( e ) ) { var l = { } ; b . each ( e , function ( a ) { l [ a ] = a } ) ; e = l } b . each ( e , function ( a , c ) { var d = document . createElement ( "option" ) ; d . innerHTML = c ; d . setAttribute ( "value" , a ) ; k . _ _select . appendChild ( d ) } ) ; this . updateDisplay ( ) ; a . bind ( this . _ _select , "change" , function ( ) { k . setValue ( this . options [ this . selectedIndex ] . value ) } ) ; this . domElement . appendChild ( this . _ _select ) } ;
d . superclass = e ; b . extend ( d . prototype , e . prototype , { setValue : function ( a ) { a = d . superclass . prototype . setValue . call ( this , a ) ; this . _ _onFinishChange && this . _ _onFinishChange . call ( this , this . getValue ( ) ) ; return a } , updateDisplay : function ( ) { this . _ _select . value = this . getValue ( ) ; return d . superclass . prototype . updateDisplay . call ( this ) } } ) ; return d } ( dat . controllers . Controller , dat . dom . dom , dat . utils . common ) ;
dat . controllers . NumberController = function ( e , a ) { var b = function ( d , f , c ) { b . superclass . call ( this , d , f ) ; c = c || { } ; this . _ _min = c . min ; this . _ _max = c . max ; this . _ _step = c . step ; a . isUndefined ( this . _ _step ) ? this . _ _impliedStep = 0 == this . initialValue ? 1 : Math . pow ( 10 , Math . floor ( Math . log ( this . initialValue ) / Math . LN10 ) ) / 10 : this . _ _impliedStep = this . _ _step ; d = this . _ _impliedStep ; d = d . toString ( ) ; d = - 1 < d . indexOf ( "." ) ? d . length - d . indexOf ( "." ) - 1 : 0 ; this . _ _precision = d } ; b . superclass = e ; a . extend ( b . prototype , e . 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 . _ _step = a ; return this } } ) ; return b } ( dat . controllers . Controller , dat . utils . common ) ;
dat . controllers . NumberControllerBox = function ( e , a , b ) { var d = function ( f , c , e ) { function k ( ) { var a = parseFloat ( n . _ _input . value ) ; b . isNaN ( a ) || n . setValue ( a ) } function l ( a ) { var c = r - a . clientY ; n . setValue ( n . getValue ( ) + c * n . _ _impliedStep ) ; r = a . clientY } function q ( ) { a . unbind ( window , "mousemove" , l ) ; a . unbind ( window , "mouseup" , q ) } this . _ _truncationSuspended = ! 1 ; d . superclass . call ( this , f , c , e ) ; var n = this , r ; this . _ _input = document . createElement ( "input" ) ; this . _ _input . setAttribute ( "type" , "text" ) ; a . bind ( this . _ _input , "change" , k ) ; a . bind ( this . _ _input ,
"blur" , function ( ) { k ( ) ; n . _ _onFinishChange && n . _ _onFinishChange . call ( n , n . getValue ( ) ) } ) ; a . bind ( this . _ _input , "mousedown" , function ( c ) { a . bind ( window , "mousemove" , l ) ; a . bind ( window , "mouseup" , q ) ; r = c . 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 ) } ; d . superclass = e ; b . extend ( d . prototype , e . prototype , { updateDisplay : function ( ) { var a = this . _ _input , c ; if ( this . _ _truncationSuspended ) c =
this . getValue ( ) ; else { c = this . getValue ( ) ; var b = Math . pow ( 10 , this . _ _precision ) ; c = Math . round ( c * b ) / b } a . value = c ; return d . superclass . prototype . updateDisplay . call ( this ) } } ) ; return d } ( dat . controllers . NumberController , dat . dom . dom , dat . utils . common ) ;
dat . controllers . NumberControllerSlider = function ( e , a , b , d , f ) { function c ( a , c , d , b , f ) { return b + ( a - c ) / ( d - c ) * ( f - b ) } var p = function ( d , b , f , e , r ) { function y ( d ) { d . preventDefault ( ) ; var b = a . getOffset ( h . _ _background ) , f = a . getWidth ( h . _ _background ) ; h . setValue ( c ( d . clientX , b . left , b . left + f , h . _ _min , h . _ _max ) ) ; return ! 1 } function g ( ) { a . unbind ( window , "mousemove" , y ) ; a . unbind ( window , "mouseup" , g ) ; h . _ _onFinishChange && h . _ _onFinishChange . call ( h , h . getValue ( ) ) } p . superclass . call ( this , d , b , { min : f , max : e , step : r } ) ; var h = this ; this . _ _background =
document . createElement ( "div" ) ; this . _ _foreground = document . createElement ( "div" ) ; a . bind ( this . _ _background , "mousedown" , function ( c ) { a . bind ( window , "mousemove" , y ) ; a . bind ( window , "mouseup" , g ) ; y ( c ) } ) ; 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 = e ; p . useDefaultStyles = function ( ) { b . inject ( f ) } ; d . extend ( p . prototype , e . prototype , { updateDisplay : function ( ) { var a =
( 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}" ) ;
dat . controllers . FunctionController = function ( e , a , b ) { var d = function ( b , c , e ) { d . superclass . call ( this , b , c ) ; var k = this ; this . _ _button = document . createElement ( "div" ) ; this . _ _button . innerHTML = void 0 === e ? "Fire" : e ; a . bind ( this . _ _button , "click" , function ( a ) { a . preventDefault ( ) ; k . fire ( ) ; return ! 1 } ) ; a . addClass ( this . _ _button , "button" ) ; this . domElement . appendChild ( this . _ _button ) } ; d . superclass = e ; b . extend ( d . prototype , e . prototype , { fire : function ( ) { this . _ _onChange && this . _ _onChange . call ( this ) ; this . _ _onFinishChange && this . _ _onFinishChange . call ( this ,
this . getValue ( ) ) ; this . getValue ( ) . call ( this . object ) } } ) ; return d } ( dat . controllers . Controller , dat . dom . dom , dat . utils . common ) ;
dat . controllers . BooleanController = function ( e , a , b ) { var d = function ( b , c ) { d . superclass . call ( this , b , c ) ; var e = this ; this . _ _prev = this . getValue ( ) ; this . _ _checkbox = document . createElement ( "input" ) ; this . _ _checkbox . setAttribute ( "type" , "checkbox" ) ; a . bind ( this . _ _checkbox , "change" , function ( ) { e . setValue ( ! e . _ _prev ) } , ! 1 ) ; this . domElement . appendChild ( this . _ _checkbox ) ; this . updateDisplay ( ) } ; d . superclass = e ; b . extend ( d . prototype , e . prototype , { setValue : function ( a ) { a = d . 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 d . superclass . prototype . updateDisplay . call ( this ) } } ) ; return d } ( dat . controllers . Controller , dat . dom . dom , dat . utils . common ) ;
dat . color . toString = function ( e ) { return function ( a ) { if ( 1 == a . a || e . 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 ( e , a ) { var b , d , 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 : e } , 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 : e } , 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 : e } , 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 : e } } } , { 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 ( c ) { return a . isNumber ( c . r ) && a . isNumber ( c . g ) && a . isNumber ( c . b ) && a . isNumber ( c . a ) ? { space : "RGB" , r : c . r , g : c . g , b : c . b , a : c . a } : ! 1 } , write : function ( a ) { return { r : a . r , g : a . g , b : a . b , a : a . a } } } , RGB _OBJ : { read : function ( c ) { return a . isNumber ( c . r ) &&
a . isNumber ( c . g ) && a . isNumber ( c . b ) ? { space : "RGB" , r : c . r , g : c . g , b : c . b } : ! 1 } , write : function ( a ) { return { r : a . r , g : a . g , b : a . b } } } , HSVA _OBJ : { read : function ( c ) { return a . isNumber ( c . h ) && a . isNumber ( c . s ) && a . isNumber ( c . v ) && a . isNumber ( c . a ) ? { space : "HSV" , h : c . h , s : c . s , v : c . v , a : c . a } : ! 1 } , write : function ( a ) { return { h : a . h , s : a . s , v : a . v , a : a . a } } } , HSV _OBJ : { read : function ( d ) { return a . isNumber ( d . h ) && a . isNumber ( d . s ) && a . isNumber ( d . v ) ? { space : "HSV" , h : d . h , s : d . s , v : d . v } : ! 1 } , write : function ( a ) { return { h : a . h , s : a . s , v : a . v } } } } } ] ; return function ( ) { d = ! 1 ;
var c = 1 < arguments . length ? a . toArray ( arguments ) : arguments [ 0 ] ; a . each ( f , function ( e ) { if ( e . litmus ( c ) ) return a . each ( e . conversions , function ( e , f ) { b = e . read ( c ) ; if ( ! 1 === d && ! 1 !== b ) return d = b , b . conversionName = f , b . conversion = e , a . BREAK } ) , a . BREAK } ) ; return d } } ( dat . color . toString , dat . utils . common ) ;
dat . GUI = dat . gui . GUI = function ( e , a , b , d , f , c , p , k , l , q , n , r , y , g , h ) { function t ( a , c , b , e ) { if ( void 0 === c [ b ] ) throw Error ( "Object " + c + ' has no property "' + b + '"' ) ; e . color ? c = new n ( c , b ) : ( c = [ c , b ] . concat ( e . factoryArgs ) , c = d . apply ( a , c ) ) ; e . before instanceof f && ( e . before = e . before . _ _li ) ; v ( a , c ) ; g . addClass ( c . domElement , "c" ) ; b = document . createElement ( "span" ) ; g . addClass ( b , "property-name" ) ; b . innerHTML = c . property ; var q = document . createElement ( "div" ) ; q . appendChild ( b ) ; q . appendChild ( c . domElement ) ; e = u ( a , q , e . before ) ; g . addClass ( e , m . CLASS _CONTROLLER _ROW ) ;
g . addClass ( e , typeof c . getValue ( ) ) ; s ( a , e , c ) ; a . _ _controllers . push ( c ) ; return c } function u ( a , d , c ) { var b = document . createElement ( "li" ) ; d && b . appendChild ( d ) ; c ? a . _ _ul . insertBefore ( b , params . before ) : a . _ _ul . appendChild ( b ) ; a . onResize ( ) ; return b } function s ( a , d , b ) { b . _ _li = d ; b . _ _gui = a ; h . extend ( b , { options : function ( d ) { if ( 1 < arguments . length ) return b . remove ( ) , t ( a , b . object , b . property , { before : b . _ _li . nextElementSibling , factoryArgs : [ h . toArray ( arguments ) ] } ) ; if ( h . isArray ( d ) || h . isObject ( d ) ) return b . remove ( ) , t ( a , b . object , b . property ,
{ before : b . _ _li . nextElementSibling , factoryArgs : [ d ] } ) } , name : function ( a ) { b . _ _li . firstElementChild . firstElementChild . innerHTML = a ; return b } , listen : function ( ) { b . _ _gui . listen ( b ) ; return b } , remove : function ( ) { b . _ _gui . remove ( b ) ; return b } } ) ; if ( b instanceof l ) { var e = new k ( b . object , b . property , { min : b . _ _min , max : b . _ _max , step : b . _ _step } ) ; h . each ( [ "updateDisplay" , "onChange" , "onFinishChange" ] , function ( a ) { var d = b [ a ] , J = e [ a ] ; b [ a ] = e [ a ] = function ( ) { var a = Array . prototype . slice . call ( arguments ) ; d . apply ( b , a ) ; return J . apply ( e , a ) } } ) ;
g . addClass ( d , "has-slider" ) ; b . domElement . insertBefore ( e . domElement , b . domElement . firstElementChild ) } else if ( b instanceof k ) { var f = function ( d ) { return h . isNumber ( b . _ _min ) && h . isNumber ( b . _ _max ) ? ( b . remove ( ) , t ( a , b . object , b . property , { before : b . _ _li . nextElementSibling , factoryArgs : [ b . _ _min , b . _ _max , b . _ _step ] } ) ) : d } ; b . min = h . compose ( f , b . min ) ; b . max = h . compose ( f , b . max ) } else b instanceof c ? ( g . bind ( d , "click" , function ( ) { g . fakeEvent ( b . _ _checkbox , "click" ) } ) , g . bind ( b . _ _checkbox , "click" , function ( a ) { a . stopPropagation ( ) } ) ) :
b instanceof p ? ( g . bind ( d , "click" , function ( ) { g . fakeEvent ( b . _ _button , "click" ) } ) , g . bind ( d , "mouseover" , function ( ) { g . addClass ( b . _ _button , "hover" ) } ) , g . bind ( d , "mouseout" , function ( ) { g . removeClass ( b . _ _button , "hover" ) } ) ) : b instanceof n && ( g . addClass ( d , "color" ) , b . updateDisplay = h . compose ( function ( a ) { d . style . borderLeftColor = b . _ _color . toString ( ) ; return a } , b . updateDisplay ) , b . updateDisplay ( ) ) ; b . setValue = h . compose ( function ( d ) { a . getRoot ( ) . _ _preset _select && b . isModified ( ) && D ( a . getRoot ( ) , ! 0 ) ; return d } , b . setValue ) } function v ( a ,
d ) { var b = a . getRoot ( ) , c = b . _ _rememberedObjects . indexOf ( d . object ) ; if ( - 1 != c ) { var e = b . _ _rememberedObjectIndecesToControllers [ c ] ; void 0 === e && ( e = { } , b . _ _rememberedObjectIndecesToControllers [ c ] = e ) ; e [ d . property ] = d ; if ( b . load && b . load . remembered ) { b = b . load . remembered ; if ( b [ a . preset ] ) b = b [ a . preset ] ; else if ( b [ z ] ) b = b [ z ] ; else return ; b [ c ] && void 0 !== b [ c ] [ d . property ] && ( c = b [ c ] [ d . property ] , d . initialValue = c , d . setValue ( c ) ) } } } function K ( 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 d = document . createElement ( "span" ) ; d . innerHTML = " " ; g . addClass ( d , "button gears" ) ; var c = document . createElement ( "span" ) ; c . innerHTML = "Save" ; g . addClass ( c , "button" ) ; g . addClass ( c , "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 ? h . each ( a . load . remembered , function ( b , d ) { E ( a , d , d == a . preset ) } ) : E ( a , z , ! 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 ( d ) ; b . appendChild ( c ) ; b . appendChild ( e ) ; b . appendChild ( f ) ; if ( w ) { var b = document . getElementById ( "dg-save-locally" ) , n = 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" ) ; var k = function ( ) { n . style . display = a . useLocalStorage ? "block" : "none" } ; k ( ) ; g . bind ( b , "change" , function ( ) { a . useLocalStorage = ! a . useLocalStorage ; k ( ) } ) } var r = document . getElementById ( "dg-new-constructor" ) ; g . bind ( r , "keydown" , function ( a ) { ! a . metaKey || 67 !== a . which && 67 != a . keyCode || A . hide ( ) } ) ; g . bind ( d , "click" , function ( ) { r . innerHTML = JSON . stringify ( a . getSaveObject ( ) , void 0 , 2 ) ; A . show ( ) ; r . focus ( ) ; r . select ( ) } ) ; g . bind ( c , "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 L ( a ) { function b ( f ) { f . preventDefault ( ) ; e = f . clientX ; g . addClass ( a . _ _closeButton , m . CLASS _DRAG ) ; g . bind ( window , "mousemove" , d ) ; g . bind ( window , "mouseup" , c ) ; return ! 1 } function d ( b ) { b . preventDefault ( ) ; a . width += e - b . clientX ; a . onResize ( ) ; e = b . clientX ; return ! 1 } function c ( ) { g . removeClass ( a . _ _closeButton , m . CLASS _DRAG ) ; g . unbind ( window , "mousemove" , d ) ; g . unbind ( window ,
"mouseup" , c ) } a . _ _resize _handle = document . createElement ( "div" ) ; h . 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 F ( 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 B ( a , b ) { var d = { } ; h . each ( a . _ _rememberedObjects , function ( c , e ) { var f = { } ; h . each ( a . _ _rememberedObjectIndecesToControllers [ e ] , function ( a , d ) { f [ d ] = b ? a . initialValue : a . getValue ( ) } ) ; d [ e ] = f } ) ; return d } function E ( a , b , d ) { var c = document . createElement ( "option" ) ; c . innerHTML = b ; c . value = b ; a . _ _preset _select . appendChild ( c ) ; d && ( a . _ _preset _select . selectedIndex = a . _ _preset _select . length - 1 ) } function D ( a , b ) { var d = a . _ _preset _select [ a . _ _preset _select . selectedIndex ] ; d . innerHTML = b ? d . value + "*" : d . value } function G ( a ) { 0 != a . length &&
r ( function ( ) { G ( a ) } ) ; h . each ( a , function ( a ) { a . updateDisplay ( ) } ) } e . inject ( b ) ; var z = "Default" , w ; try { w = "localStorage" in window && null !== window . localStorage } catch ( M ) { w = ! 1 } var A , H = ! 0 , x , C = ! 1 , I = [ ] , m = function ( a ) { function b ( ) { localStorage . setItem ( document . location . href + ".gui" , JSON . stringify ( c . getSaveObject ( ) ) ) } function d ( ) { var a = c . getRoot ( ) ; a . width += 1 ; h . defer ( function ( ) { a . width -= 1 } ) } 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 = h . defaults ( a , { autoPlace : ! 0 , width : m . DEFAULT _WIDTH } ) ; a = h . defaults ( a , { resizable : a . autoPlace , hideable : a . autoPlace } ) ; h . isUndefined ( a . load ) ? a . load = { preset : z } : a . preset && ( a . load . preset = a . preset ) ; h . isUndefined ( a . parent ) && a . hideable && I . push ( this ) ; a . resizable = h . isUndefined ( a . parent ) && a . resizable ; a . autoPlace && h . isUndefined ( a . scrollable ) &&
( a . scrollable = ! 0 ) ; var e = w && "true" === localStorage . getItem ( document . location . href + ".isLocal" ) ; 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 ; F ( 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 , 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 e } , set : function ( a ) { w &&
( ( e = a ) ? g . bind ( window , "unload" , b ) : g . unbind ( window , "unload" , b ) , localStorage . setItem ( document . location . href + ".isLocal" , a ) ) } } } ) ; if ( h . isUndefined ( a . parent ) ) { a . closed = ! 1 ; g . addClass ( this . domElement , m . CLASS _MAIN ) ; g . makeSelectable ( this . domElement , ! 1 ) ; if ( w && e ) { 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 q = document . createTextNode ( a . name ) ; g . addClass ( q , "controller-name" ) ; f = u ( c , q ) ; 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 && ( h . isUndefined ( a . parent ) && ( H && ( x = document . createElement ( "div" ) , g . addClass ( x , "dg" ) , g . addClass ( x , m . CLASS _AUTO _PLACE _CONTAINER ) , document . body . appendChild ( x ) ,
H = ! 1 ) , x . appendChild ( this . domElement ) , g . addClass ( this . domElement , m . CLASS _AUTO _PLACE ) ) , this . parent || F ( 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 && L ( this ) ; c . getRoot ( ) ; a . parent || d ( ) } ; m . toggleHide = function ( ) { C = ! C ; h . each ( I , function ( a ) { a . domElement . style . zIndex = C ? - 999 : 999 ; a . domElement . style . opacity =
C ? 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" ; g . bind ( window , "keydown" , function ( a ) { "text" === document . activeElement . type || 72 !== a . which && 72 != a . keyCode || m . toggleHide ( ) } , ! 1 ) ; h . extend ( m . prototype , { add : function ( a , b ) { return t ( this , a , b , { factoryArgs : Array . prototype . slice . call ( arguments ,
2 ) } ) } , addColor : function ( a , b ) { return t ( this , a , b , { color : ! 0 } ) } , remove : function ( a ) { this . _ _ul . removeChild ( a . _ _li ) ; this . _ _controllers . slice ( this . _ _controllers . indexOf ( a ) , 1 ) ; var b = this ; h . defer ( function ( ) { b . onResize ( ) } ) } , destroy : function ( ) { this . autoPlace && x . 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 m ( b ) ; this . _ _folders [ a ] = b ; a = u ( 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 , d = 0 ; h . each ( a . _ _ul . childNodes , function ( b ) { a . autoPlace && b === a . _ _save _row || ( d += g . getHeight ( b ) ) } ) ; window . innerHeight - b - 20 < d ? ( 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 && h . defer ( function ( ) { a . _ _resize _handle . style . height = a . _ _ul . offsetHeight + "px" } ) ; a . _ _closeButton && ( a . _ _closeButton . style . width = a . width + "px" ) } , remember : function ( ) { h . isUndefined ( A ) && ( A = new y , A . domElement . innerHTML = a ) ; if ( this . parent ) throw Error ( "You can only call remember on a top level GUI." ) ; var b = this ; h . each ( Array . prototype . slice . call ( arguments ) , function ( a ) { 0 == b . _ _rememberedObjects . length && K ( b ) ; - 1 ==
b . _ _rememberedObjects . indexOf ( a ) && b . _ _rememberedObjects . push ( a ) } ) ; this . autoPlace && F ( 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 ] = B ( this ) ) ; a . folders = { } ; h . each ( this . _ _folders , function ( b , d ) { a . folders [ d ] = b . getSaveObject ( ) } ) ; return a } , save : function ( ) { this . load . remembered || ( this . load . remembered =
{ } ) ; this . load . remembered [ this . preset ] = B ( this ) ; D ( this , ! 1 ) } , saveAs : function ( a ) { this . load . remembered || ( this . load . remembered = { } , this . load . remembered [ z ] = B ( this , ! 0 ) ) ; this . load . remembered [ a ] = B ( this ) ; this . preset = a ; E ( this , a , ! 0 ) } , revert : function ( a ) { h . each ( this . _ _controllers , function ( b ) { this . getRoot ( ) . load . remembered ? v ( a || this . getRoot ( ) , b ) : b . setValue ( b . initialValue ) } , this ) ; h . each ( this . _ _folders , function ( a ) { a . revert ( a ) } ) ; a || D ( this . getRoot ( ) , ! 1 ) } , listen : function ( a ) { var b = 0 == this . _ _listening . length ; this . _ _listening . push ( a ) ;
b && G ( 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
2013-12-18 23:27:02 +00:00
dat . controllers . factory = function ( e , a , b , d , f , c , p ) { return function ( k , l , q , n ) { var r = k [ l ] ; if ( p . isArray ( q ) || p . isObject ( q ) ) return new e ( k , l , q ) ; if ( p . isNumber ( r ) ) return p . isNumber ( q ) && p . isNumber ( n ) ? new b ( k , l , q , n ) : new a ( k , l , { min : q , max : n } ) ; if ( p . isString ( r ) ) return new d ( k , l ) ; if ( p . isFunction ( r ) ) return new f ( k , l , "" ) ; if ( p . isBoolean ( r ) ) return new c ( k , l ) } } ( dat . controllers . OptionController , dat . controllers . NumberControllerBox , dat . controllers . NumberControllerSlider , dat . controllers . StringController = function ( e , a , b ) { var d =
function ( b , c ) { function e ( ) { k . setValue ( k . _ _input . value ) } d . superclass . call ( this , b , c ) ; var k = this ; this . _ _input = document . createElement ( "input" ) ; this . _ _input . setAttribute ( "type" , "text" ) ; a . bind ( this . _ _input , "keyup" , e ) ; a . bind ( this . _ _input , "change" , e ) ; a . bind ( this . _ _input , "blur" , function ( ) { k . _ _onFinishChange && k . _ _onFinishChange . call ( k , k . getValue ( ) ) } ) ; a . bind ( this . _ _input , "keydown" , function ( a ) { 13 === a . keyCode && this . blur ( ) } ) ; this . updateDisplay ( ) ; this . domElement . appendChild ( this . _ _input ) } ; d . superclass = e ; b . extend ( d . prototype ,
e . prototype , { updateDisplay : function ( ) { a . isActive ( this . _ _input ) || ( this . _ _input . value = this . getValue ( ) ) ; return d . superclass . prototype . updateDisplay . call ( this ) } } ) ; return d } ( 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 ( e , a , b , d , f ) { function c ( a , b , d , c ) { a . style . background = "" ; f . each ( l , function ( e ) { a . style . cssText += "background: " + e + "linear-gradient(" + b + ", " + d + " 0%, " + c + " 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 k = function ( e , n ) { function r ( b ) { t ( b ) ; a . bind ( window , "mousemove" , t ) ; a . bind ( window ,
"mouseup" , l ) } function l ( ) { a . unbind ( window , "mousemove" , t ) ; a . unbind ( window , "mouseup" , l ) } function g ( ) { var a = d ( this . value ) ; ! 1 !== a ? ( s . _ _color . _ _state = a , s . setValue ( s . _ _color . toOriginal ( ) ) ) : this . value = s . _ _color . toString ( ) } function h ( ) { a . unbind ( window , "mousemove" , u ) ; a . unbind ( window , "mouseup" , h ) } function t ( b ) { b . preventDefault ( ) ; var d = a . getWidth ( s . _ _saturation _field ) , c = a . getOffset ( s . _ _saturation _field ) , e = ( b . clientX - c . left + document . body . scrollLeft ) / d ; b = 1 - ( b . clientY - c . top + document . body . scrollTop ) / d ; 1 < b ? b = 1 : 0 >
b && ( b = 0 ) ; 1 < e ? e = 1 : 0 > e && ( e = 0 ) ; s . _ _color . v = b ; s . _ _color . s = e ; s . setValue ( s . _ _color . toOriginal ( ) ) ; return ! 1 } function u ( b ) { b . preventDefault ( ) ; var d = a . getHeight ( s . _ _hue _field ) , c = a . getOffset ( s . _ _hue _field ) ; b = 1 - ( b . clientY - c . top + document . body . scrollTop ) / d ; 1 < b ? b = 1 : 0 > b && ( b = 0 ) ; s . _ _color . h = 360 * b ; s . setValue ( s . _ _color . toOriginal ( ) ) ; return ! 1 } k . superclass . call ( this , e , n ) ; this . _ _color = new b ( this . getValue ( ) ) ; this . _ _temp = new b ( 0 ) ; var s = this ; this . domElement = document . createElement ( "div" ) ; a . makeSelectable ( this . domElement , ! 1 ) ;
this . _ _selector = document . createElement ( "div" ) ; this . _ _selector . className = "selector" ; this . _ _saturation _field = document . createElement ( "div" ) ; this . _ _saturation _field . className = "saturation-field" ; this . _ _field _knob = document . createElement ( "div" ) ; this . _ _field _knob . className = "field-knob" ; this . _ _field _knob _border = "2px solid " ; this . _ _hue _knob = document . createElement ( "div" ) ; this . _ _hue _knob . className = "hue-knob" ; this . _ _hue _field = document . createElement ( "div" ) ; this . _ _hue _field . className = "hue-field" ; this . _ _input = document . createElement ( "input" ) ;
this . _ _input . type = "text" ; this . _ _input _textShadow = "0 1px 1px " ; a . bind ( this . _ _input , "keydown" , function ( a ) { 13 === a . keyCode && 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 ( s . _ _selector , "drag" ) } ) } ) ; var v = 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 + ( 0.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 ( v . style , { width : "100%" , height : "100%" ,
background : "none" } ) ; c ( v , "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" } ) ; p ( 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" , r ) ; a . bind ( this . _ _field _knob , "mousedown" , r ) ; a . bind ( this . _ _hue _field , "mousedown" , function ( b ) { u ( b ) ; a . bind ( window ,
"mousemove" , u ) ; a . bind ( window , "mouseup" , h ) } ) ; this . _ _saturation _field . appendChild ( v ) ; 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 ( ) } ; k . superclass = e ; f . extend ( k . prototype , e . prototype , { updateDisplay : function ( ) { var a = d ( this . getValue ( ) ) ; if ( ! 1 !== a ) { var e = ! 1 ;
f . each ( b . COMPONENTS , function ( b ) { if ( ! f . isUndefined ( a [ b ] ) && ! f . isUndefined ( this . _ _color . _ _state [ b ] ) && a [ b ] !== this . _ _color . _ _state [ b ] ) return e = ! 0 , { } } , this ) ; e && f . extend ( this . _ _color . _ _state , a ) } f . extend ( this . _ _temp . _ _state , this . _ _color . _ _state ) ; this . _ _temp . a = 1 ; var k = 0.5 > this . _ _color . v || 0.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 ; c ( 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 l = [ "-moz-" , "-o-" , "-webkit-" , "-ms-" , "" ] ; return k } ( dat . controllers . Controller , dat . dom . dom , dat . color . Color = function ( e , a , b , d ) { function f ( a ,
b , d ) { Object . defineProperty ( a , b , { get : function ( ) { if ( "RGB" === this . _ _state . space ) return this . _ _state [ b ] ; p ( this , b , d ) ; return this . _ _state [ b ] } , set : function ( a ) { "RGB" !== this . _ _state . space && ( p ( this , b , d ) , this . _ _state . space = "RGB" ) ; this . _ _state [ b ] = a } } ) } function c ( a , b ) { Object . defineProperty ( a , b , { get : function ( ) { if ( "HSV" === this . _ _state . space ) return this . _ _state [ b ] ; k ( this ) ; return this . _ _state [ b ] } , set : function ( a ) { "HSV" !== this . _ _state . space && ( k ( this ) , this . _ _state . space = "HSV" ) ; this . _ _state [ b ] = a } } ) } function p ( b , c , e ) { if ( "HEX" ===
b . _ _state . space ) b . _ _state [ c ] = a . component _from _hex ( b . _ _state . hex , e ) ; else if ( "HSV" === b . _ _state . space ) d . extend ( b . _ _state , a . hsv _to _rgb ( b . _ _state . h , b . _ _state . s , b . _ _state . v ) ) ; else throw "Corrupted color state" ; } function k ( b ) { var c = a . rgb _to _hsv ( b . r , b . g , b . b ) ; d . extend ( b . _ _state , { s : c . s , v : c . v } ) ; d . isNaN ( c . h ) ? d . isUndefined ( b . _ _state . h ) && ( b . _ _state . h = 0 ) : b . _ _state . h = c . h } var l = function ( ) { this . _ _state = e . 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 ( " " ) ; d . extend ( l . prototype , { toString : function ( ) { return b ( this ) } , toOriginal : function ( ) { return this . _ _state . conversion . write ( this ) } } ) ; f ( l . prototype , "r" , 2 ) ; f ( l . prototype , "g" , 1 ) ; f ( l . prototype , "b" , 0 ) ; c ( l . prototype , "h" ) ; c ( l . prototype , "s" ) ; c ( 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 =
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 e ; return { hsv _to _rgb : function ( a , b , d ) { var e = a / 60 - Math . floor ( a / 60 ) , c = d * ( 1 - b ) , p = d * ( 1 - e * b ) ; b = d * ( 1 - ( 1 - e ) * b ) ; a = [ [ d , b , c ] , [ p , d , c ] , [ c , d , b ] , [ c , p , d ] , [ b , c , d ] , [ d , c , p ] ] [ Math . floor ( a / 60 ) % 6 ] ; return { r : 255 * a [ 0 ] , g : 255 * a [ 1 ] , b : 255 * a [ 2 ] } } , rgb _to _hsv : function ( a , b , d ) { var e = Math . min ( a , b , d ) , c = Math . max ( a , b , d ) , e = c - e ; if ( 0 == c ) return { h : NaN , s : 0 , v : 0 } ;
a = ( a == c ? ( b - d ) / e : b == c ? 2 + ( d - a ) / e : 4 + ( a - b ) / e ) / 6 ; 0 > a && ( a += 1 ) ; return { h : 360 * a , s : e / c , v : c / 255 } } , rgb _to _hex : function ( a , b , d ) { a = this . hex _with _component ( 0 , 2 , a ) ; a = this . hex _with _component ( a , 1 , b ) ; return a = this . hex _with _component ( a , 0 , d ) } , component _from _hex : function ( a , b ) { return a >> 8 * b & 255 } , hex _with _component : function ( a , b , d ) { return d << ( e = 8 * b ) | a & ~ ( 255 << e ) } } } ( ) , dat . color . toString , dat . utils . common ) , dat . color . interpret , dat . utils . common ) , dat . utils . requestAnimationFrame = function ( ) { return window . webkitRequestAnimationFrame ||
window . mozRequestAnimationFrame || window . oRequestAnimationFrame || window . msRequestAnimationFrame || function ( e , a ) { window . setTimeout ( e , 1E3 / 60 ) } } ( ) , dat . dom . CenteredDiv = function ( e , a ) { var b = 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" } ) ; e . 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" } ) ; document . body . appendChild ( this . backgroundElement ) ; document . body . appendChild ( this . domElement ) ; var b = this ; e . bind ( this . backgroundElement , "click" , function ( ) { b . hide ( ) } ) } ; b . 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)" } ) } ; b . prototype . hide = function ( ) { var a = this , b = function ( ) { a . domElement . style . display = "none" ; a . backgroundElement . style . display = "none" ; e . unbind ( a . domElement , "webkitTransitionEnd" , b ) ; e . unbind ( a . domElement , "transitionend" , b ) ; e . unbind ( a . domElement , "oTransitionEnd" , b ) } ; e . bind ( this . domElement , "webkitTransitionEnd" ,
b ) ; e . bind ( this . domElement , "transitionend" , b ) ; e . bind ( this . domElement , "oTransitionEnd" , b ) ; this . backgroundElement . style . opacity = 0 ; this . domElement . style . opacity = 0 ; this . domElement . style . webkitTransform = "scale(1.1)" } ; b . prototype . layout = function ( ) { this . domElement . style . left = window . innerWidth / 2 - e . getWidth ( this . domElement ) / 2 + "px" ; this . domElement . style . top = window . innerHeight / 2 - e . getHeight ( this . domElement ) / 2 + "px" } ; return b } ( dat . dom . dom , dat . utils . common ) , dat . dom . dom , dat . utils . common ) ;