OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * 'settings-animated-pages' is a container for a page and animated subpages. | 7 * 'settings-animated-pages' is a container for a page and animated subpages. |
8 * It provides a set of common behaviors and animations. | 8 * It provides a set of common behaviors and animations. |
9 * | 9 * |
10 * Example: | 10 * Example: |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 this.queuedRouteChange_.oldRoute)); | 114 this.queuedRouteChange_.oldRoute)); |
115 }, | 115 }, |
116 | 116 |
117 /** @protected */ | 117 /** @protected */ |
118 currentRouteChanged: function(newRoute, oldRoute) { | 118 currentRouteChanged: function(newRoute, oldRoute) { |
119 this.previousRoute_ = oldRoute; | 119 this.previousRoute_ = oldRoute; |
120 | 120 |
121 if (newRoute.section == this.section && newRoute.isSubpage()) { | 121 if (newRoute.section == this.section && newRoute.isSubpage()) { |
122 this.switchToSubpage_(newRoute, oldRoute); | 122 this.switchToSubpage_(newRoute, oldRoute); |
123 } else { | 123 } else { |
124 this.$.animatedPages.exitAnimation = 'fade-out-animation'; | 124 this.$.animatedPages.exitAnimation = 'settings-fade-out-animation'; |
125 this.$.animatedPages.entryAnimation = 'fade-in-animation'; | 125 this.$.animatedPages.entryAnimation = 'settings-fade-in-animation'; |
126 this.$.animatedPages.selected = 'default'; | 126 this.$.animatedPages.selected = 'default'; |
127 } | 127 } |
128 }, | 128 }, |
129 | 129 |
130 /** | 130 /** |
131 * Selects the subpage specified by |newRoute|. | 131 * Selects the subpage specified by |newRoute|. |
132 * @param {!settings.Route} newRoute | 132 * @param {!settings.Route} newRoute |
133 * @param {!settings.Route} oldRoute | 133 * @param {!settings.Route} oldRoute |
134 * @private | 134 * @private |
135 */ | 135 */ |
(...skipping 11 matching lines...) Expand all Loading... |
147 if (oldRoute.isSubpage() && newRoute.depth > oldRoute.depth) { | 147 if (oldRoute.isSubpage() && newRoute.depth > oldRoute.depth) { |
148 // Slide left for a deeper subpage. | 148 // Slide left for a deeper subpage. |
149 this.$.animatedPages.exitAnimation = 'slide-left-animation'; | 149 this.$.animatedPages.exitAnimation = 'slide-left-animation'; |
150 this.$.animatedPages.entryAnimation = 'slide-from-right-animation'; | 150 this.$.animatedPages.entryAnimation = 'slide-from-right-animation'; |
151 } else if (oldRoute.depth > newRoute.depth) { | 151 } else if (oldRoute.depth > newRoute.depth) { |
152 // Slide right for a shallower subpage. | 152 // Slide right for a shallower subpage. |
153 this.$.animatedPages.exitAnimation = 'slide-right-animation'; | 153 this.$.animatedPages.exitAnimation = 'slide-right-animation'; |
154 this.$.animatedPages.entryAnimation = 'slide-from-left-animation'; | 154 this.$.animatedPages.entryAnimation = 'slide-from-left-animation'; |
155 } else { | 155 } else { |
156 // The old route is not a subpage or is at the same level, so just fade. | 156 // The old route is not a subpage or is at the same level, so just fade. |
157 this.$.animatedPages.exitAnimation = 'fade-out-animation'; | 157 this.$.animatedPages.exitAnimation = 'settings-fade-out-animation'; |
158 this.$.animatedPages.entryAnimation = 'fade-in-animation'; | 158 this.$.animatedPages.entryAnimation = 'settings-fade-in-animation'; |
159 | 159 |
160 if (!oldRoute.isSubpage()) { | 160 if (!oldRoute.isSubpage()) { |
161 // Set the height the expand animation should start at before | 161 // Set the height the expand animation should start at before |
162 // beginning the transition to the new subpage. | 162 // beginning the transition to the new subpage. |
163 // TODO(michaelpg): Remove MainPageBehavior's dependency on this | 163 // TODO(michaelpg): Remove MainPageBehavior's dependency on this |
164 // height being set. | 164 // height being set. |
165 this.style.height = this.clientHeight + 'px'; | 165 this.style.height = this.clientHeight + 'px'; |
166 this.async(function() { | 166 this.async(function() { |
167 this.style.height = ''; | 167 this.style.height = ''; |
168 }); | 168 }); |
(...skipping 27 matching lines...) Expand all Loading... |
196 // instance, such that the stamped instance will also be ignored by the | 196 // instance, such that the stamped instance will also be ignored by the |
197 // searching algorithm. | 197 // searching algorithm. |
198 if (template.hasAttribute('no-search')) | 198 if (template.hasAttribute('no-search')) |
199 subpage.setAttribute('no-search', ''); | 199 subpage.setAttribute('no-search', ''); |
200 | 200 |
201 // Render synchronously so neon-animated-pages can select the subpage. | 201 // Render synchronously so neon-animated-pages can select the subpage. |
202 template.if = true; | 202 template.if = true; |
203 template.render(); | 203 template.render(); |
204 }, | 204 }, |
205 }); | 205 }); |
OLD | NEW |