mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
46 lines
1.0 KiB
JavaScript
46 lines
1.0 KiB
JavaScript
Polymer('gui-panel', {
|
|
|
|
ready: function() {
|
|
|
|
document.body.appendChild( this );
|
|
|
|
},
|
|
|
|
add: function( object, property ) {
|
|
|
|
var row = document.createElement( 'gui-row' );
|
|
row.name = property;
|
|
|
|
var controller;
|
|
|
|
if ( typeof object[ property ] == 'number' ) {
|
|
|
|
controller = document.createElement( 'number-controller' );
|
|
|
|
if ( arguments[ 2 ] !== undefined ) controller.min = arguments[ 2 ];
|
|
if ( arguments[ 3 ] !== undefined ) controller.max = arguments[ 3 ];
|
|
if ( arguments[ 4 ] !== undefined ) controller.step = arguments[ 4 ];
|
|
|
|
}
|
|
|
|
controller.object = object;
|
|
controller.property = property;
|
|
|
|
controller.name = function( name ) {
|
|
row.name = name;
|
|
};
|
|
|
|
row.appendChild( controller );
|
|
this.appendChild( row );
|
|
|
|
return controller;
|
|
|
|
},
|
|
|
|
listenAll: function() {
|
|
|
|
console.warn( 'controller.listenAll() is deprecated. All controllers are listened for free.' );
|
|
|
|
}
|
|
|
|
}); |