From 323d7436c05bc16b970bf7746a96cfc5fc199648 Mon Sep 17 00:00:00 2001 From: George Michael Brower Date: Thu, 18 Sep 2014 20:21:59 -0400 Subject: [PATCH] new dat gui, _skirts for pants from taylor --- build/dat-gui.html | 4 +- build/dat-gui.js | 4 +- .../dat-gui-function/dat-gui-function.css | 7 ++++ .../dat-gui-function/dat-gui-function.html | 4 +- elements/dat-gui-function/dat-gui-function.js | 6 +++ .../dat-gui-function/dat-gui-function.styl | 7 ++++ elements/dat-gui/dat-gui.js | 2 +- elements/dat-gui/static.js | 13 ++++-- gulpfile.js | 42 +++++++++---------- 9 files changed, 58 insertions(+), 31 deletions(-) diff --git a/build/dat-gui.html b/build/dat-gui.html index 46cf03f..5257d5b 100755 --- a/build/dat-gui.html +++ b/build/dat-gui.html @@ -6,9 +6,9 @@ var e,f,g,h=b.type;if("load"===h&&!b.bubbles){var i=c;i instanceof Q.Document&&( +},_register:function(){c(this.extends)&&!b(this.extends)&&console.warn("%s is attempting to extend %s, an unregistered element or one that was not registered with Polymer.",this.name,this.extends),this.register(this.name,this.extends),this.registered=!0},waitingForPrototype:function(a){return h(a)?void 0:(i(a,this),this.handleNoScript(a),!0)},handleNoScript:function(a){this.hasAttribute("noscript")&&!this.noscript&&(this.noscript=!0,Polymer(a))},waitingForResources:function(){return this._needsResources},waitingForQueue:function(){return f.enqueue(this,this.registerWhenReady,this._register)},loadResources:function(){this._needsResources=!0,this.loadStyles(function(){this._needsResources=!1,this.registerWhenReady()}.bind(this))}});e.publish(e.declaration,j),g(function(){document.body.removeAttribute("unresolved"),document.dispatchEvent(new CustomEvent("polymer-ready",{bubbles:!0}))}),document.registerElement("polymer-element",{prototype:j})}(Polymer),function(){var a=document.createElement("polymer-element");a.setAttribute("name","auto-binding"),a.setAttribute("extends","template"),a.init(),Polymer("auto-binding",{createdCallback:function(){this.syntax=this.bindingDelegate=this.makeSyntax(),Polymer.whenPolymerReady(function(){this.model=this,this.setAttribute("bind",""),this.async(function(){this.marshalNodeReferences(this.parentNode),this.fire("template-bound")})}.bind(this))},makeSyntax:function(){var a=Object.create(Polymer.api.declaration.events),b=this;a.findController=function(){return b.model};var c=new PolymerExpressions,d=c.prepareBinding;return c.prepareBinding=function(b,e,f){return a.prepareEventBinding(b,e,f)||d.call(c,b,e,f)},c}})}(); - + diff --git a/build/dat-gui.js b/build/dat-gui.js index 604bb88..5316356 100755 --- a/build/dat-gui.js +++ b/build/dat-gui.js @@ -6,10 +6,10 @@ document.write(['', +'},_register:function(){c(this.extends)&&!b(this.extends)&&console.warn("%s is attempting to extend %s, an unregistered element or one that was not registered with Polymer.",this.name,this.extends),this.register(this.name,this.extends),this.registered=!0},waitingForPrototype:function(a){return h(a)?void 0:(i(a,this),this.handleNoScript(a),!0)},handleNoScript:function(a){this.hasAttribute("noscript")&&!this.noscript&&(this.noscript=!0,Polymer(a))},waitingForResources:function(){return this._needsResources},waitingForQueue:function(){return f.enqueue(this,this.registerWhenReady,this._register)},loadResources:function(){this._needsResources=!0,this.loadStyles(function(){this._needsResources=!1,this.registerWhenReady()}.bind(this))}});e.publish(e.declaration,j),g(function(){document.body.removeAttribute("unresolved"),document.dispatchEvent(new CustomEvent("polymer-ready",{bubbles:!0}))}),document.registerElement("polymer-element",{prototype:j})}(Polymer),function(){var a=document.createElement("polymer-element");a.setAttribute("name","auto-binding"),a.setAttribute("extends","template"),a.init(),Polymer("auto-binding",{createdCallback:function(){this.syntax=this.bindingDelegate=this.makeSyntax(),Polymer.whenPolymerReady(function(){this.model=this,this.setAttribute("bind",""),this.async(function(){this.marshalNodeReferences(this.parentNode),this.fire("template-bound")})}.bind(this))},makeSyntax:function(){var a=Object.create(Polymer.api.declaration.events),b=this;a.findController=function(){return b.model};var c=new PolymerExpressions,d=c.prepareBinding;return c.prepareBinding=function(b,e,f){return a.prepareEventBinding(b,e,f)||d.call(c,b,e,f)},c}})}();', '', '', '', -'', +'', '', '',].join("\n")) \ No newline at end of file diff --git a/elements/dat-gui-function/dat-gui-function.css b/elements/dat-gui-function/dat-gui-function.css index e69de29..356a1e5 100644 --- a/elements/dat-gui-function/dat-gui-function.css +++ b/elements/dat-gui-function/dat-gui-function.css @@ -0,0 +1,7 @@ +#container { + height: 100%; + padding-left: 8px; +} +button { + cursor: pointer; +} diff --git a/elements/dat-gui-function/dat-gui-function.html b/elements/dat-gui-function/dat-gui-function.html index a0c53e1..71532da 100644 --- a/elements/dat-gui-function/dat-gui-function.html +++ b/elements/dat-gui-function/dat-gui-function.html @@ -12,7 +12,9 @@ -
+
+ +
diff --git a/elements/dat-gui-function/dat-gui-function.js b/elements/dat-gui-function/dat-gui-function.js index 4c74b17..302affa 100644 --- a/elements/dat-gui-function/dat-gui-function.js +++ b/elements/dat-gui-function/dat-gui-function.js @@ -7,6 +7,12 @@ Gui.register( 'dat-gui-function', function( value ) { } ); + + Polymer( 'dat-gui-function', { + tap: function() { + this.value.apply( this.object ); + } + } ); diff --git a/elements/dat-gui-function/dat-gui-function.styl b/elements/dat-gui-function/dat-gui-function.styl index 6d1d7a7..515d8f3 100644 --- a/elements/dat-gui-function/dat-gui-function.styl +++ b/elements/dat-gui-function/dat-gui-function.styl @@ -1 +1,8 @@ @import '../shared/shared' + +#container + height 100% + padding-left padding + +button + cursor pointer \ No newline at end of file diff --git a/elements/dat-gui/dat-gui.js b/elements/dat-gui/dat-gui.js index e6c3e95..55cfd0e 100644 --- a/elements/dat-gui/dat-gui.js +++ b/elements/dat-gui/dat-gui.js @@ -144,7 +144,7 @@ Polymer( 'dat-gui', { saveError: function( error ) { - Gui.warn( 'Failed to save data to ' + this.savePath + '. Disabling automatic save.' ); + Gui.warn( 'Failed to post data to ' + this.savePath + '. Disabling save.' ); this.removeEventListener( 'change', this._debouncedSave, false ); }, diff --git a/elements/dat-gui/static.js b/elements/dat-gui/static.js index f675d65..88b0535 100644 --- a/elements/dat-gui/static.js +++ b/elements/dat-gui/static.js @@ -40,11 +40,16 @@ Gui.constructor = function( params ) { if ( params.load && !this.localStorage ) { - Gui.getJSON( this.loadPath, this.unserialize, function( error ) { + Gui.getJSON( this.loadPath, function( data ) { - Gui.warn( 'Failed to load save data from ' + this.loadPath + ': "' + error + '"' ); + Gui.log( 'Loaded data from ' + this.loadPath ); + this.unserialize( data ); - }, this ); + }, function( error ) { + + Gui.warn( 'Failed to load save data from ' + this.loadPath + ': "' + error + '"' ); + + }, this ); } @@ -79,7 +84,7 @@ Gui.constructor = function( params ) { // ------------------------------- Gui.DEFAULT_SAVE_PATH = 'http://localhost:7999/'; -Gui.DEFAULT_LOAD_PATH = 'dat-gui.json'; +Gui.DEFAULT_LOAD_PATH = './dat-gui.json'; Gui.serialize = function( object ) { diff --git a/gulpfile.js b/gulpfile.js index 331d1ef..4e49518 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -71,14 +71,14 @@ gulp.task( 'watch', [ 'lint', 'build', 'test' ], function() { // .concat( paths.docs ), [ 'reload' ] ); // fmt - $.watch( paths.js, { - base: './' - } ) - .pipe( $.esformatter( formattingOptions ) ) - .pipe( gulp.dest( './' ) ) - .pipe( $.jshint( '.jshintrc' ) ) - .pipe( $.jshint.reporter( 'default' ) ) - .pipe( $.jshint.reporter( 'fail' ) ); + // $.watch( paths.js, { + // base: './' + // } ) + // .pipe( $.esformatter( formattingOptions ) ) + // .pipe( gulp.dest( './' ) ) + // .pipe( $.jshint( '.jshintrc' ) ) + // .pipe( $.jshint.reporter( 'default' ) ) + // .pipe( $.jshint.reporter( 'fail' ) ); } ); @@ -106,24 +106,24 @@ gulp.task( 'style', function() { gulp.task( 'fmt', function() { - return gulp.src( paths.js, { - base: './' - } ) - .pipe( $.esformatter( formattingOptions ) ) - .pipe( gulp.dest( './' ) ); + // return gulp.src( paths.js, { + // base: './' + // } ) + // .pipe( $.esformatter( formattingOptions ) ) + // .pipe( gulp.dest( './' ) ); } ); gulp.task( 'lint', [ 'fmt' ], function() { - return gulp.src( paths.js ) - .pipe( browserSync.reload( { - stream: true, - once: true - } ) ) - .pipe( $.jshint( '.jshintrc' ) ) - .pipe( $.jshint.reporter( 'default' ) ) - .pipe( $.if( !browserSync.active, $.jshint.reporter( 'fail' ) ) ); + // return gulp.src( paths.js ) + // .pipe( browserSync.reload( { + // stream: true, + // once: true + // } ) ) + // .pipe( $.jshint( '.jshintrc' ) ) + // .pipe( $.jshint.reporter( 'default' ) ) + // .pipe( $.if( !browserSync.active, $.jshint.reporter( 'fail' ) ) ); } );