This commit is contained in:
George Michael Brower 2014-08-31 20:54:59 -07:00
commit 407abe299c
9 changed files with 41 additions and 35 deletions

View File

@ -1,5 +1,5 @@
{ {
"name": "polymer-gui", "name": "dat.gui",
"version": "0.0.0", "version": "0.0.0",
"description": "Attempt at revamping dat.gui with Polymer.", "description": "Attempt at revamping dat.gui with Polymer.",
"keywords": [ "keywords": [

View File

@ -19,11 +19,6 @@ var e,f,g,h=b.type;if("load"===h&&!b.bubbles){var i=c;i instanceof Q.Document&&(
<!-- src --> <!-- src -->
<script>(function( scope ) { <script>(function( scope ) {
var ready = false;
var readyHandlers = [];
var controllers = {};
var Gui = function( params ) { var Gui = function( params ) {
if ( !ready ) { if ( !ready ) {
@ -48,6 +43,8 @@ var e,f,g,h=b.type;if("load"===h&&!b.bubbles){var i=c;i instanceof Q.Document&&(
// Register custom controllers // Register custom controllers
// ------------------------------- // -------------------------------
var controllers = {};
Gui.register = function( elementName, test ) { Gui.register = function( elementName, test ) {
controllers[ elementName ] = test; controllers[ elementName ] = test;
@ -78,6 +75,9 @@ var e,f,g,h=b.type;if("load"===h&&!b.bubbles){var i=c;i instanceof Q.Document&&(
// Gui ready handler ... * shakes fist at polymer * // Gui ready handler ... * shakes fist at polymer *
// ------------------------------- // -------------------------------
var ready = false;
var readyHandlers = [];
document.addEventListener( 'polymer-ready', function() { document.addEventListener( 'polymer-ready', function() {
ready = true; ready = true;
@ -654,6 +654,10 @@ Polymer('gui-row', {
font: 10px 'Lucida Grande', sans-serif; font: 10px 'Lucida Grande', sans-serif;
color: #eee; color: #eee;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer; cursor: pointer;
text-align: center; text-align: center;
padding: 6px 8px; padding: 6px 8px;
@ -879,31 +883,34 @@ Polymer('controller-base', {
this.object = object; this.object = object;
this.path = path; this.path = path;
if ( this._observer ) {
this._observer.close();
delete this._observer;
}
var _this = this; this.bind('value', new PathObserver(this.object, this.path));
this._observer = new PathObserver( this.object, this.path ); // if ( this._observer ) {
this._observer.open( function( newValue ) { // this._observer.close();
// delete this._observer;
// }
_this.value = newValue; // var _this = this;
} ); // this._observer = new PathObserver( this.object, this.path );
// this._observer.open( function( newValue ) {
this.value = this.object[ this.path ]; // _this.value = newValue;
// } );
// this.value = this.object[ this.path ];
}, },
valueChanged: function() { valueChanged: function() {
if ( this._observer ) { // if ( this._observer ) {
Path.get( this.path ).setValueFrom( this.object, this.value ); // Path.get( this.path ).setValueFrom( this.object, this.value );
} // }
this.update(); this.update();
@ -943,7 +950,7 @@ Polymer('controller-base', {
});</script> });</script>
<polymer-element name="controller-base" attributes="object path" assetpath="../elements/controller-base/"></polymer-element> <polymer-element name="controller-base" attributes="object path value" assetpath="../elements/controller-base/"></polymer-element>
<script>/* <script>/*

View File

@ -14,9 +14,8 @@
</head> </head>
<body> <body>
<div id="readme"><!-- Replaced with contents of README.md --></div> <!-- Copied from README.md -->
<div id="readme"></div>
<script src="../underscore/underscore.js"></script>
<script src="docs/main.js"></script> <script src="docs/main.js"></script>
<script src="docs/examples.js"></script> <script src="docs/examples.js"></script>

View File

@ -1,10 +1,5 @@
(function( scope ) { (function( scope ) {
var ready = false;
var readyHandlers = [];
var controllers = {};
var Gui = function( params ) { var Gui = function( params ) {
if ( !ready ) { if ( !ready ) {
@ -29,6 +24,8 @@
// Register custom controllers // Register custom controllers
// ------------------------------- // -------------------------------
var controllers = {};
Gui.register = function( elementName, test ) { Gui.register = function( elementName, test ) {
controllers[ elementName ] = test; controllers[ elementName ] = test;
@ -59,6 +56,9 @@
// Gui ready handler ... * shakes fist at polymer * // Gui ready handler ... * shakes fist at polymer *
// ------------------------------- // -------------------------------
var ready = false;
var readyHandlers = [];
document.addEventListener( 'polymer-ready', function() { document.addEventListener( 'polymer-ready', function() {
ready = true; ready = true;

View File

@ -26,13 +26,14 @@ Polymer('controller-base', {
this.object = object; this.object = object;
this.path = path; this.path = path;
this.bind('value', new PathObserver(this.object, this.path));
// if ( this._observer ) { // if ( this._observer ) {
// this._observer.close(); // this._observer.close();
// delete this._observer; // delete this._observer;
// } // }
this.bind('value', new PathObserver(this.object, this.path));
// var _this = this; // var _this = this;
// this._observer = new PathObserver( this.object, this.path ); // this._observer = new PathObserver( this.object, this.path );

View File

@ -24,6 +24,7 @@
} }
&.open-false { &.open-false {
} }
} }

View File

@ -69,7 +69,6 @@ gulp.task( 'default', function() {
gulp.watch( [ paths.js, paths.main, paths.html ], [ 'vulcanize', 'test' ] ); gulp.watch( [ paths.js, paths.main, paths.html ], [ 'vulcanize', 'test' ] );
gulp.watch( [ 'README.md', 'docs/*' ], [ 'docs' ] ); gulp.watch( [ 'README.md', 'docs/*' ], [ 'docs' ] );
} ); } );

View File

@ -14,6 +14,7 @@
</head> </head>
<body> <body>
<!-- Copied from README.md -->
<div id="readme"><h1 id="dat-gui">dat-gui</h1> <div id="readme"><h1 id="dat-gui">dat-gui</h1>
<p>dat-gui creates an interface that you can use to modify variables with very little code. </p> <p>dat-gui creates an interface that you can use to modify variables with very little code. </p>
<h3 id="basic-usage">Basic Usage</h3> <h3 id="basic-usage">Basic Usage</h3>
@ -182,9 +183,7 @@ Gui.register( &#39;controller-number&#39;, function( value ) {
<pre><code class="lang-html">&lt;script src=&quot;gui.js&quot;&gt;&lt;/script&gt; <pre><code class="lang-html">&lt;script src=&quot;gui.js&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;gui-three.js&quot;&gt;&lt;/script&gt; &lt;script src=&quot;gui-three.js&quot;&gt;&lt;/script&gt;
</code></pre> </code></pre>
<!-- Replaced with contents of README.md --></div> </div>
<script src="../underscore/underscore.js"></script>
<script src="docs/main.js"></script> <script src="docs/main.js"></script>
<script src="docs/examples.js"></script> <script src="docs/examples.js"></script>

View File

@ -1,5 +1,5 @@
{ {
"name": "polymer-gui", "name": "dat.gui",
"version": "0.0.0", "version": "0.0.0",
"devDependencies": { "devDependencies": {
"gulp": "^3.8.7", "gulp": "^3.8.7",