Merge branch 'polymer' of github.com:dataarts/dat.gui into polymer

This commit is contained in:
Doug Fritz 2014-09-15 15:59:34 -07:00
commit 637b9e5da3
10 changed files with 91 additions and 30 deletions

View File

@ -14,6 +14,8 @@ NEW FEATURES
- [ ] dividers - [ ] dividers
- [ ] save server !! - [ ] save server !!
- [ ] * disable * listen - [ ] * disable * listen
- [ ] override gui.var initialValues with url.js
- [x] docked container
BUILD BUILD

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -66,6 +66,16 @@
.touch-true #closeButton { .touch-true #closeButton {
font-size: 13.5px; font-size: 13.5px;
} }
#dockedContent:not(:empty) {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 245px;
}
.open-false #dockedContent:not(:empty) {
right: 0;
}
gui-button { gui-button {
font: 10px 'Lucida Grande', sans-serif; font: 10px 'Lucida Grande', sans-serif;
color: #ecebe0; color: #ecebe0;

View File

@ -12,6 +12,11 @@
<div id="container" class="docked-{{ docked }} autoplace-{{ autoPlace }} open-{{ open }} touch-{{ touch }}" > <div id="container" class="docked-{{ docked }} autoplace-{{ autoPlace }} open-{{ open }} touch-{{ touch }}" >
<div id="dockedContent">
</div>
<div id="panel"> <div id="panel">
<div id="controllers"> <div id="controllers">
@ -22,8 +27,10 @@
</div> </div>
</div> </div>
</template> </template>
<script src="dat-gui.js"></script> <script src="dat-gui.js"></script>

View File

@ -12,6 +12,7 @@ Polymer( 'dat-gui', {
ready: function() { ready: function() {
this.vars = {}; this.vars = {};
this.domElement = this; // legacy
}, },
@ -124,6 +125,8 @@ Polymer( 'dat-gui', {
} }
this.asyncFire( 'resize' );
}, },
dockedChanged: function() { dockedChanged: function() {
@ -215,26 +218,44 @@ Gui.getController = function( value ) {
var ready = false; var ready = false;
var readyHandlers = []; var readyHandlers = [];
var readyPromise;
function readyResolve( resolve ) {
readyHandlers.forEach( function( fnc ) {
fnc();
} );
if ( resolve !== undefined ) {
resolve();
}
}
document.addEventListener( 'polymer-ready', function() { document.addEventListener( 'polymer-ready', function() {
ready = true; ready = true;
readyHandlers.forEach( function( fnc ) { if ( !readyPromise ) {
readyResolve();
fnc(); }
} );
} ); } );
Gui.ready = function( fnc ) { Gui.ready = function( fnc ) {
if ( window.Promise && arguments.length === 0 ) {
readyPromise = new Promise( readyResolve );
return readyPromise;
}
if ( ready ) { if ( ready ) {
fnc(); fnc();
} else { } else {
readyHandlers.push( fnc ); readyHandlers.push( fnc );
} }
}; };

View File

@ -39,6 +39,7 @@ dur = 0.4s
#controllers #controllers
panel-font() panel-font()
.docked-true & .docked-true &
position absolute position absolute
width 100% width 100%
@ -54,6 +55,20 @@ dur = 0.4s
padding padding * 0.75 padding padding padding * 0.75 padding
#dockedContent:not(:empty)
position: fixed
top: 0
left: 0
bottom: 0
// needs to be dynamic if we do panel resizing again
right: panel-width
.open-false &
right: 0
gui-button gui-button
panel-font() panel-font()
background color-panel background color-panel
@ -81,4 +96,4 @@ gui-button
.docked-false & .docked-false &
right 0 right 0
left 0 left 0

View File

@ -5,11 +5,11 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>dat-gui kitchen sink</title> <title>dat-gui kitchen sink</title>
<script src="../build/dat-gui.js"></script> <!-- // <script src="../build/dat-gui.js"></script> -->
<!--
<script src="../../platform/platform.js"></script> <script src="../../platform/platform.js"></script>
<link rel="import" href="../dat-gui.html"> <link rel="import" href="../dat-gui.html">
-->
<meta name="viewport" content="width=device-width, user-scalable=no"> <meta name="viewport" content="width=device-width, user-scalable=no">
@ -76,6 +76,15 @@
// console.log( val ); // console.log( val );
}); });
var testElement = document.createElement( 'div' );
testElement.id = 'test';
testElement.innerHTML = 'test dock container';
testElement.style.left = '50%';
testElement.style.top = '50%';
testElement.style.position = 'absolute';
gui.$.dockedContent.appendChild( testElement );
} ); } );
</script> </script>

View File

@ -77,7 +77,7 @@ gulp.task( 'watch', [ 'lint', 'build', 'test' ], function() {
.pipe( $.esformatter( formattingOptions ) ) .pipe( $.esformatter( formattingOptions ) )
.pipe( gulp.dest( './' ) ) .pipe( gulp.dest( './' ) )
.pipe( $.jshint( '.jshintrc' ) ) .pipe( $.jshint( '.jshintrc' ) )
.pipe( $.jshint.reporter( 'jshint-stylish' ) ) .pipe( $.jshint.reporter( 'default' ) )
.pipe( $.jshint.reporter( 'fail' ) ); .pipe( $.jshint.reporter( 'fail' ) );
} ); } );
@ -122,7 +122,7 @@ gulp.task( 'lint', [ 'fmt' ], function() {
once: true once: true
} ) ) } ) )
.pipe( $.jshint( '.jshintrc' ) ) .pipe( $.jshint( '.jshintrc' ) )
.pipe( $.jshint.reporter( 'jshint-stylish' ) ) .pipe( $.jshint.reporter( 'default' ) )
.pipe( $.if( !browserSync.active, $.jshint.reporter( 'fail' ) ) ); .pipe( $.if( !browserSync.active, $.jshint.reporter( 'fail' ) ) );
} ); } );

View File

@ -23,7 +23,6 @@
"gulp-watch": "^1.0.3", "gulp-watch": "^1.0.3",
"gulp-wrap": "^0.3.0", "gulp-wrap": "^0.3.0",
"highlight.js": "^8.2.0", "highlight.js": "^8.2.0",
"jshint-stylish": "^0.4.0",
"karma": "^0.12.23", "karma": "^0.12.23",
"karma-jasmine": "^0.1.5", "karma-jasmine": "^0.1.5",
"nib": "^1.0.3", "nib": "^1.0.3",