mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
gui.define* => gui.var*
This commit is contained in:
parent
64a7d0b630
commit
f98ac9b462
3
TODO.md
3
TODO.md
@ -6,7 +6,7 @@ BUILD
|
||||
REFACTOR
|
||||
|
||||
- [ ] controller-* => gui-*
|
||||
- [ ] gui.define* => gui.var*
|
||||
- [x] gui.define* => gui.var*
|
||||
- [ ] Gui.js => gui-panel => dat-gui
|
||||
|
||||
PARITY
|
||||
@ -30,7 +30,6 @@ DOCS
|
||||
- [ ] Auto generatated polymer docs
|
||||
|
||||
STYLE
|
||||
|
||||
- [x] touch styles: bigger please!
|
||||
- [x] kill hover behavior if touch
|
||||
- [x] sharing more styles
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
// Properties
|
||||
|
||||
this.defined = {};
|
||||
this.vars = {};
|
||||
this.localStorage = params.localStorage || false;
|
||||
|
||||
// Make domElement
|
||||
@ -84,22 +84,22 @@
|
||||
|
||||
};
|
||||
|
||||
Gui.prototype.define = function() {
|
||||
Gui.prototype.var = function() {
|
||||
|
||||
var name, initialValue, args;
|
||||
|
||||
if ( arguments.length == 1 ) {
|
||||
name = arguments[ 0 ];
|
||||
return this.defined[ name ];
|
||||
return this.vars[ name ];
|
||||
}
|
||||
|
||||
initialValue = arguments[ 1 ];
|
||||
name = arguments[ 0 ];
|
||||
|
||||
args = [ this.defined, name ];
|
||||
args = [ this.vars, name ];
|
||||
args = args.concat( Array.prototype.slice.call( arguments, 2 ) );
|
||||
|
||||
this.defined[ name ] = initialValue;
|
||||
this.vars[ name ] = initialValue;
|
||||
|
||||
return this.add.apply( this, args );
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
var Gui = function() {
|
||||
|
||||
this.defined = {};
|
||||
this.vars = {};
|
||||
|
||||
};
|
||||
|
||||
@ -15,9 +15,9 @@
|
||||
|
||||
};
|
||||
|
||||
Gui.prototype.define = function( name, value ) {
|
||||
Gui.prototype.var = function( name, value ) {
|
||||
|
||||
this.defined[ name ] = value;
|
||||
this.vars[ name ] = value;
|
||||
return controllerShim;
|
||||
|
||||
};
|
||||
|
@ -65,7 +65,7 @@
|
||||
|
||||
gui.add( object, 'maxIsNegative', -5, -2 );
|
||||
|
||||
gui.define( 'anonymousSlider', 0, -1, 1 ).comment( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam semper dui metus');
|
||||
gui.var( 'anonymousSlider', 0, -1, 1 ).comment( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam semper dui metus');
|
||||
|
||||
gui.add( object, 'optionController', { A: 'a', B: 'b', C: 'c'} );
|
||||
gui.add( object, 'optionController', [ 'a', 'b', 'c' ] )
|
||||
|
@ -32,7 +32,7 @@ describe( 'Gui', function() {
|
||||
|
||||
expectController( 'controller-number', 1234 );
|
||||
expectController( 'controller-string', 'string value' );
|
||||
expectController( 'controller-function', function(){} );
|
||||
expectController( 'controller-function', function() {} );
|
||||
expectController( 'controller-boolean', true );
|
||||
|
||||
expectController( 'controller-option', 'hey', [ 'hey', 'hi', 'ho' ] );
|
||||
@ -75,7 +75,7 @@ describe( 'Gui', function() {
|
||||
args.unshift( value );
|
||||
args.unshift( 'name' );
|
||||
|
||||
controller = gui.define.apply( gui, args );
|
||||
controller = gui.var.apply( gui, args );
|
||||
expect( controller.nodeName.toLowerCase() ).toBe( controllerType );
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user