From d76808c344895b0db2756585c2bc06c96fb6782a Mon Sep 17 00:00:00 2001 From: George Michael Brower Date: Sun, 7 Sep 2014 19:55:40 -0400 Subject: [PATCH] option controller --- build/gui.html | 4 ++-- build/gui.js | 4 ++-- elements/controller-base/controller-base.js | 8 +++++-- .../controller-number/controller-number.js | 4 ++++ .../controller-option/controller-option.html | 8 +++---- .../controller-option/controller-option.js | 24 ++++++++++++++++++- elements/gui-panel/gui-panel.js | 1 - examples/index.html | 2 +- 8 files changed, 42 insertions(+), 13 deletions(-) diff --git a/build/gui.html b/build/gui.html index 900466a..2315390 100644 --- a/build/gui.html +++ b/build/gui.html @@ -14,8 +14,8 @@ if(d?f=f.toModel:"function"==typeof f.toDOM&&(f=f.toDOM),"function"!=typeof f)re - + - \ No newline at end of file + \ No newline at end of file diff --git a/build/gui.js b/build/gui.js index 7ba03c4..f6e4e99 100644 --- a/build/gui.js +++ b/build/gui.js @@ -14,8 +14,8 @@ document.write(['', +'', '', '', '', -'',].join("\n")) \ No newline at end of file +'',].join("\n")) \ No newline at end of file diff --git a/elements/controller-base/controller-base.js b/elements/controller-base/controller-base.js index 2eb53f8..ad46bb3 100644 --- a/elements/controller-base/controller-base.js +++ b/elements/controller-base/controller-base.js @@ -4,7 +4,6 @@ [ ] onFinishChange( ) */ - Polymer('controller-base', { ready: function() { @@ -26,7 +25,7 @@ Polymer('controller-base', { this.object = object; this.path = path; - this.bind('value', new PathObserver(this.object, this.path)); + this.bind( 'value', new PathObserver( this.object, this.path ) ); }, @@ -45,6 +44,11 @@ Polymer('controller-base', { return ( x - a ) / ( b - a ) * ( d - c ) + c; }, + on: function( event, listener ) { + this.addEventListener( event, listener ); + return this; + }, + // Legacy // ------------------------------- diff --git a/elements/controller-number/controller-number.js b/elements/controller-number/controller-number.js index 7bd5a07..72865a1 100644 --- a/elements/controller-number/controller-number.js +++ b/elements/controller-number/controller-number.js @@ -164,12 +164,16 @@ Polymer( 'controller-number', { this._rect = this.$.track.getBoundingClientRect(); if ( !this._alt ) this.value = this.valueFromX( e.x ); + this.fire( 'sliderDown' ); + }, up: function( e ) { // this.$.container.classList.add( 'transition' ); + this.fire( 'sliderUp' ); + }, trackstart: function( e ) { diff --git a/elements/controller-option/controller-option.html b/elements/controller-option/controller-option.html index b0d20f5..bdd0da9 100644 --- a/elements/controller-option/controller-option.html +++ b/elements/controller-option/controller-option.html @@ -2,7 +2,7 @@ - +