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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 // Don't manipulate the light DOM until it's ready. | 85 // Don't manipulate the light DOM until it's ready. |
86 if (!this.lightDomReady_) { | 86 if (!this.lightDomReady_) { |
87 this.queuedRouteChange_ = this.queuedRouteChange_ || {oldRoute: oldRoute}; | 87 this.queuedRouteChange_ = this.queuedRouteChange_ || {oldRoute: oldRoute}; |
88 this.queuedRouteChange_.newRoute = newRoute; | 88 this.queuedRouteChange_.newRoute = newRoute; |
89 return; | 89 return; |
90 } | 90 } |
91 | 91 |
92 this.ensureSubpageInstance_(); | 92 this.ensureSubpageInstance_(); |
93 | 93 |
94 if (oldRoute) { | 94 if (oldRoute) { |
95 if (oldRoute.isSubpage() && oldRoute.contains(newRoute)) { | 95 if (oldRoute.isSubpage() && newRoute.depth > oldRoute.depth) { |
michaelpg
2016/08/17 00:40:49
Wait a minute, isn't this exactly what we had prev
tommycli
2016/08/17 16:17:00
Previously we checked if the subpage.length > 0, b
| |
96 // Slide left for a descendant subpage. | 96 // Slide left for a deeper subpage. |
97 this.$.animatedPages.exitAnimation = 'slide-left-animation'; | 97 this.$.animatedPages.exitAnimation = 'slide-left-animation'; |
98 this.$.animatedPages.entryAnimation = 'slide-from-right-animation'; | 98 this.$.animatedPages.entryAnimation = 'slide-from-right-animation'; |
99 } else if (newRoute.contains(oldRoute)) { | 99 } else if (oldRoute.depth > newRoute.depth) { |
100 // Slide right for an ancestor subpage. | 100 // Slide right for an shallower subpage. |
michaelpg
2016/08/17 00:40:49
s/an/a
tommycli
2016/08/17 16:17:00
Done.
| |
101 this.$.animatedPages.exitAnimation = 'slide-right-animation'; | 101 this.$.animatedPages.exitAnimation = 'slide-right-animation'; |
102 this.$.animatedPages.entryAnimation = 'slide-from-left-animation'; | 102 this.$.animatedPages.entryAnimation = 'slide-from-left-animation'; |
103 } else { | 103 } else { |
104 // The old route is not a subpage or is at the same level, so just fade. | 104 // The old route is not a subpage or is at the same level, so just fade. |
105 this.$.animatedPages.exitAnimation = 'fade-out-animation'; | 105 this.$.animatedPages.exitAnimation = 'fade-out-animation'; |
106 this.$.animatedPages.entryAnimation = 'fade-in-animation'; | 106 this.$.animatedPages.entryAnimation = 'fade-in-animation'; |
107 | 107 |
108 if (!oldRoute.isSubpage()) { | 108 if (!oldRoute.isSubpage()) { |
109 // Set the height the expand animation should start at before | 109 // Set the height the expand animation should start at before |
110 // beginning the transition to the new subpage. | 110 // beginning the transition to the new subpage. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 // instance, such that the stamped instance will also be ignored by the | 144 // instance, such that the stamped instance will also be ignored by the |
145 // searching algorithm. | 145 // searching algorithm. |
146 if (template.hasAttribute('no-search')) | 146 if (template.hasAttribute('no-search')) |
147 subpage.setAttribute('no-search', ''); | 147 subpage.setAttribute('no-search', ''); |
148 | 148 |
149 // Render synchronously so neon-animated-pages can select the subpage. | 149 // Render synchronously so neon-animated-pages can select the subpage. |
150 template.if = true; | 150 template.if = true; |
151 template.render(); | 151 template.render(); |
152 }, | 152 }, |
153 }); | 153 }); |
OLD | NEW |