Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(843)

Side by Side Diff: chrome/browser/resources/settings/settings_page/settings_animated_pages.js

Issue 1965553002: MD Settings: Page and animation fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // For transitioning between subpages at different levels, slide. 104 // For transitioning between subpages at different levels, slide.
105 if (newRoute.subpage.length > oldRoute.subpage.length) { 105 if (newRoute.subpage.length > oldRoute.subpage.length) {
106 this.$.animatedPages.exitAnimation = 'slide-left-animation'; 106 this.$.animatedPages.exitAnimation = 'slide-left-animation';
107 this.$.animatedPages.entryAnimation = 'slide-from-right-animation'; 107 this.$.animatedPages.entryAnimation = 'slide-from-right-animation';
108 } else { 108 } else {
109 this.$.animatedPages.exitAnimation = 'slide-right-animation'; 109 this.$.animatedPages.exitAnimation = 'slide-right-animation';
110 this.$.animatedPages.entryAnimation = 'slide-from-left-animation'; 110 this.$.animatedPages.entryAnimation = 'slide-from-left-animation';
111 } 111 }
112 } 112 }
113 113
114 this.$.animatedPages.selected = 114 if (newRouteIsSubpage && newRoute.section == this.section)
dpapad 2016/05/09 21:34:58 Nit (optional): Ternary operator could be used her
michaelpg 2016/05/09 23:12:38 Think I'll keep it as is. I tried it a couple ways
115 newRouteIsSubpage ? newRoute.subpage.slice(-1)[0] : 'main'; 115 this.$.animatedPages.selected = newRoute.subpage.slice(-1)[0];
116 else
117 this.$.animatedPages.selected = 'main';
116 }, 118 },
117 119
118 /** 120 /**
119 * Ensures that the template enclosing the subpage is stamped. 121 * Ensures that the template enclosing the subpage is stamped.
120 * @private 122 * @private
121 */ 123 */
122 ensureSubpageInstance_: function() { 124 ensureSubpageInstance_: function() {
123 var id = this.currentRoute.subpage.slice(-1)[0]; 125 var id = this.currentRoute.subpage.slice(-1)[0];
124 var template = Polymer.dom(this).querySelector( 126 var template = Polymer.dom(this).querySelector(
125 'template[name="' + id + '"]'); 127 'template[name="' + id + '"]');
(...skipping 18 matching lines...) Expand all
144 * Buttons in this pageset should use this method to transition to subpages. 146 * Buttons in this pageset should use this method to transition to subpages.
145 */ 147 */
146 setSubpageChain: function(subpage) { 148 setSubpageChain: function(subpage) {
147 this.currentRoute = { 149 this.currentRoute = {
148 page: this.currentRoute.page, 150 page: this.currentRoute.page,
149 section: subpage.length > 0 ? this.section : '', 151 section: subpage.length > 0 ? this.section : '',
150 subpage: subpage, 152 subpage: subpage,
151 }; 153 };
152 }, 154 },
153 }); 155 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698