| 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 var selectedPage = event.detail.item; |
| 37 | 35 |
| 38 var selectedPage = this.selectedItem; | 36 // Only consider child elements. |
| 37 if (this.items.indexOf(selectedPage) < 0) { |
| 38 return; |
| 39 } |
| 40 |
| 39 var oldPage = this._valueToItem(this._prevSelected) || false; | 41 var oldPage = this._valueToItem(this._prevSelected) || false; |
| 40 this._prevSelected = selected; | 42 this._prevSelected = this.selected; |
| 41 | 43 |
| 42 // on initial load and if animateInitialSelection is negated, simply displ
ay selectedPage. | 44 // on initial load and if animateInitialSelection is negated, simply displ
ay selectedPage. |
| 43 if (!oldPage && !this.animateInitialSelection) { | 45 if (!oldPage && !this.animateInitialSelection) { |
| 44 this._completeSelectedChanged(); | 46 this._completeSelectedChanged(); |
| 45 return; | 47 return; |
| 46 } | 48 } |
| 47 | 49 |
| 48 // insert safari fix. | 50 // insert safari fix. |
| 49 this.animationConfig = [{ | 51 this.animationConfig = [{ |
| 50 name: 'opaque-animation', | 52 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); | 157 var selectedPage = this.selectedItem || this._valueToItem(this.selected); |
| 156 this.resizerShouldNotify = function(element) { | 158 this.resizerShouldNotify = function(element) { |
| 157 return element == selectedPage; | 159 return element == selectedPage; |
| 158 } | 160 } |
| 159 this.notifyResize(); | 161 this.notifyResize(); |
| 160 } | 162 } |
| 161 | 163 |
| 162 }) | 164 }) |
| 163 | 165 |
| 164 })(); | 166 })(); |
| OLD | NEW |