| OLD | NEW |
| 1 (function() { | 1 (function() { |
| 2 | 2 |
| 3 Polymer({ | 3 Polymer({ |
| 4 | 4 |
| 5 is: 'neon-animated-pages', | 5 is: 'neon-animated-pages', |
| 6 | 6 |
| 7 behaviors: [ | 7 behaviors: [ |
| 8 Polymer.IronResizableBehavior, | 8 Polymer.IronResizableBehavior, |
| 9 Polymer.IronSelectableBehavior, | 9 Polymer.IronSelectableBehavior, |
| 10 Polymer.NeonAnimationRunnerBehavior | 10 Polymer.NeonAnimationRunnerBehavior |
| 11 ], | 11 ], |
| 12 | 12 |
| 13 properties: { | 13 properties: { |
| 14 | 14 |
| 15 activateEvent: { | 15 activateEvent: { |
| 16 type: String, | 16 type: String, |
| 17 value: '' | 17 value: '' |
| 18 }, | 18 }, |
| 19 | 19 |
| 20 // if true, the initial page selection will also be animated according to
its animation config. | 20 // if true, the initial page selection will also be animated according to
its animation config. |
| 21 animateInitialSelection: { | 21 animateInitialSelection: { |
| 22 type: Boolean, | 22 type: Boolean, |
| 23 value: false | 23 value: false |
| 24 } | 24 } |
| 25 | 25 |
| 26 }, | 26 }, |
| 27 | 27 |
| 28 observers: [ | |
| 29 '_selectedChanged(selected)' | |
| 30 ], | |
| 31 | |
| 32 listeners: { | 28 listeners: { |
| 29 'iron-select': '_onIronSelect', |
| 33 'neon-animation-finish': '_onNeonAnimationFinish' | 30 'neon-animation-finish': '_onNeonAnimationFinish' |
| 34 }, | 31 }, |
| 35 | 32 |
| 36 _selectedChanged: function(selected) { | 33 _onIronSelect: function(event) { |
| 34 // ignore if the event is not trigger by a page selection |
| 35 if (Polymer.dom(event).rootTarget !== this) return; |
| 37 | 36 |
| 38 var selectedPage = this.selectedItem; | 37 var selectedPage = event.detail.item; |
| 38 if (!selectedPage) return; |
| 39 |
| 39 var oldPage = this._valueToItem(this._prevSelected) || false; | 40 var oldPage = this._valueToItem(this._prevSelected) || false; |
| 40 this._prevSelected = selected; | 41 this._prevSelected = this.selected; |
| 41 | 42 |
| 42 // on initial load and if animateInitialSelection is negated, simply displ
ay selectedPage. | 43 // on initial load and if animateInitialSelection is negated, simply displ
ay selectedPage. |
| 43 if (!oldPage && !this.animateInitialSelection) { | 44 if (!oldPage && !this.animateInitialSelection) { |
| 44 this._completeSelectedChanged(); | 45 this._completeSelectedChanged(); |
| 45 return; | 46 return; |
| 46 } | 47 } |
| 47 | 48 |
| 48 // insert safari fix. | 49 // insert safari fix. |
| 49 this.animationConfig = [{ | 50 this.animationConfig = [{ |
| 50 name: 'opaque-animation', | 51 name: 'opaque-animation', |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 var selectedPage = this.selectedItem || this._valueToItem(this.selected); | 156 var selectedPage = this.selectedItem || this._valueToItem(this.selected); |
| 156 this.resizerShouldNotify = function(element) { | 157 this.resizerShouldNotify = function(element) { |
| 157 return element == selectedPage; | 158 return element == selectedPage; |
| 158 } | 159 } |
| 159 this.notifyResize(); | 160 this.notifyResize(); |
| 160 } | 161 } |
| 161 | 162 |
| 162 }) | 163 }) |
| 163 | 164 |
| 164 })(); | 165 })(); |
| OLD | NEW |