OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 * Responds to route changes by expanding, collapsing, or scrolling to sections | 6 * Responds to route changes by expanding, collapsing, or scrolling to sections |
7 * on the page. Expanded sections take up the full height of the container. At | 7 * on the page. Expanded sections take up the full height of the container. At |
8 * most one section should be expanded at any given time. | 8 * most one section should be expanded at any given time. |
9 * @polymerBehavior MainPageBehavior | 9 * @polymerBehavior MainPageBehavior |
10 */ | 10 */ |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 } else { | 109 } else { |
110 // Scroll to top while sliding to another subpage. | 110 // Scroll to top while sliding to another subpage. |
111 this.scroller.scrollTop = 0; | 111 this.scroller.scrollTop = 0; |
112 } | 112 } |
113 } else if (currentSection) { | 113 } else if (currentSection) { |
114 // Expand the section into a subpage or scroll to it on the main page. | 114 // Expand the section into a subpage or scroll to it on the main page. |
115 if (currentRoute.isSubpage()) | 115 if (currentRoute.isSubpage()) |
116 promise = this.expandSection_(currentSection); | 116 promise = this.expandSection_(currentSection); |
117 else if (scrollToSection) | 117 else if (scrollToSection) |
118 currentSection.scrollIntoView(); | 118 currentSection.scrollIntoView(); |
119 } else if (settings.Route.ADVANCED.contains(currentRoute)) { | |
120 promise = new Promise(function(resolve) { | |
121 this.$$('#advancedPageTemplate').get().then(resolve); | |
122 }.bind(this)); | |
Dan Beam
2017/03/17 00:30:05
does this work
promise = this.$$('#advancedPageTe
dpapad
2017/03/17 20:53:55
It does. Done.
| |
119 } | 123 } |
120 | 124 |
121 // When this animation ends, another may be necessary. Call this function | 125 // When this animation ends, another may be necessary. Call this function |
122 // again after the promise resolves. | 126 // again after the promise resolves. |
123 if (promise) | 127 if (promise) |
124 promise.then(this.tryTransitionToSection_.bind(this, scrollToSection)); | 128 promise.then(this.tryTransitionToSection_.bind(this, scrollToSection)); |
125 }, | 129 }, |
126 | 130 |
127 /** | 131 /** |
128 * If the current animation is inconsistent with the current route, stops the | 132 * If the current animation is inconsistent with the current route, stops the |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
304 return /** @type {?SettingsSectionElement} */( | 308 return /** @type {?SettingsSectionElement} */( |
305 this.$$('settings-section[section="' + section + '"]')); | 309 this.$$('settings-section[section="' + section + '"]')); |
306 }, | 310 }, |
307 }; | 311 }; |
308 | 312 |
309 /** @polymerBehavior */ | 313 /** @polymerBehavior */ |
310 var MainPageBehavior = [ | 314 var MainPageBehavior = [ |
311 settings.RouteObserverBehavior, | 315 settings.RouteObserverBehavior, |
312 MainPageBehaviorImpl, | 316 MainPageBehaviorImpl, |
313 ]; | 317 ]; |
OLD | NEW |