dat.gui/elements/gui-panel/gui-panel.js

54 lines
1.1 KiB
JavaScript
Raw Normal View History

2014-09-08 03:36:20 +00:00
/* globals Polymer */
2014-09-04 04:14:36 +00:00
2014-09-03 16:16:11 +00:00
// [ ] scrolling when docked
// [ ] scrolling when window short and not docked
2014-08-27 00:01:15 +00:00
2014-09-08 01:31:51 +00:00
Polymer( 'gui-panel', {
2014-08-27 00:01:15 +00:00
2014-09-08 01:31:51 +00:00
docked: false,
open: true,
2014-09-08 03:36:20 +00:00
touch: ( 'ontouchstart' in window ) || ( !!window.DocumentTouch && document instanceof window.DocumentTouch ),
2014-08-27 00:01:15 +00:00
2014-09-08 03:36:20 +00:00
2014-09-08 01:31:51 +00:00
// Observers
// -------------------------------
2014-08-27 00:01:15 +00:00
2014-09-08 01:31:51 +00:00
openChanged: function() {
2014-08-27 00:01:15 +00:00
2014-09-08 01:31:51 +00:00
if ( this.open || this.docked ) {
2014-08-27 00:01:15 +00:00
2014-09-08 01:31:51 +00:00
// let the style sheet take care of things
this.$.container.style.transform = '';
this.$.panel.style.transform = '';
2014-08-27 00:01:15 +00:00
2014-09-08 01:31:51 +00:00
} else {
2014-08-27 00:01:15 +00:00
2014-09-08 01:31:51 +00:00
// todo: need the rest of the vendor prefixes ...
// wish i could pipe javascript variables into styl.
var y = -this.$.controllers.offsetHeight + 'px';
this.$.container.style.transform = 'translate3d( 0, ' + y + ', 0 )';
2014-08-27 00:01:15 +00:00
2014-09-08 01:31:51 +00:00
}
2014-08-27 00:01:15 +00:00
2014-09-08 01:31:51 +00:00
},
2014-08-27 00:01:15 +00:00
2014-09-08 01:31:51 +00:00
dockedChanged: function() {
2014-08-27 00:01:15 +00:00
2014-09-08 01:31:51 +00:00
this.openChanged();
2014-08-27 00:01:15 +00:00
2014-09-08 01:31:51 +00:00
},
2014-08-27 00:01:15 +00:00
2014-09-08 03:36:20 +00:00
2014-09-08 01:31:51 +00:00
// Events
// -------------------------------
2014-08-27 00:01:15 +00:00
2014-09-08 01:31:51 +00:00
tapClose: function() {
this.open = !this.open;
},
2014-08-27 00:01:15 +00:00
2014-09-07 20:18:36 +00:00
toggleOpen: function() {
2014-08-27 00:01:15 +00:00
this.open = !this.open;
2014-09-08 01:31:51 +00:00
}
2014-08-27 00:01:15 +00:00
2014-09-08 01:38:29 +00:00
} );