OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 var Page = cr.ui.pageManager.Page; | 6 var Page = cr.ui.pageManager.Page; |
7 var PageManager = cr.ui.pageManager.PageManager; | 7 var PageManager = cr.ui.pageManager.PageManager; |
8 | 8 |
9 // The scale ratio of the display rectangle to its original size. | 9 // The scale ratio of the display rectangle to its original size. |
10 /** @const */ var VISUAL_SCALE = 1 / 10; | 10 /** @const */ var VISUAL_SCALE = 1 / 10; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 ['Options_DisplaySetOverscan']); | 191 ['Options_DisplaySetOverscan']); |
192 }.bind(this); | 192 }.bind(this); |
193 | 193 |
194 chrome.send('getDisplayInfo'); | 194 chrome.send('getDisplayInfo'); |
195 }, | 195 }, |
196 | 196 |
197 /** @override */ | 197 /** @override */ |
198 didShowPage: function() { | 198 didShowPage: function() { |
199 var optionTitles = document.getElementsByClassName( | 199 var optionTitles = document.getElementsByClassName( |
200 'selected-display-option-title'); | 200 'selected-display-option-title'); |
| 201 |
201 var maxSize = 0; | 202 var maxSize = 0; |
202 for (var i = 0; i < optionTitles.length; i++) | 203 for (var i = 0; i < optionTitles.length; i++) { |
203 maxSize = Math.max(maxSize, optionTitles[i].clientWidth); | 204 maxSize = Math.max(maxSize, optionTitles[i].clientWidth); |
204 for (var i = 0; i < optionTitles.length; i++) | 205 } |
| 206 |
| 207 for (var i = 0; i < optionTitles.length; i++) { |
205 optionTitles[i].style.width = maxSize + 'px'; | 208 optionTitles[i].style.width = maxSize + 'px'; |
206 }, | 209 } |
207 | 210 |
208 /** @override */ | 211 chrome.send('getDisplayInfo'); |
209 onVisibilityChanged_: function() { | |
210 Page.prototype.onVisibilityChanged_(this); | |
211 if (this.visible) | |
212 chrome.send('getDisplayInfo'); | |
213 }, | 212 }, |
214 | 213 |
215 /** | 214 /** |
216 * Mouse move handler for dragging display rectangle. | 215 * Mouse move handler for dragging display rectangle. |
217 * @param {Event} e The mouse move event. | 216 * @param {Event} e The mouse move event. |
218 * @private | 217 * @private |
219 */ | 218 */ |
220 onMouseMove_: function(e) { | 219 onMouseMove_: function(e) { |
221 return this.processDragging_(e, {x: e.pageX, y: e.pageY}); | 220 return this.processDragging_(e, {x: e.pageX, y: e.pageY}); |
222 }, | 221 }, |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 mirroring, displays, layout, offset) { | 875 mirroring, displays, layout, offset) { |
877 DisplayOptions.getInstance().onDisplayChanged_( | 876 DisplayOptions.getInstance().onDisplayChanged_( |
878 mirroring, displays, layout, offset); | 877 mirroring, displays, layout, offset); |
879 }; | 878 }; |
880 | 879 |
881 // Export | 880 // Export |
882 return { | 881 return { |
883 DisplayOptions: DisplayOptions | 882 DisplayOptions: DisplayOptions |
884 }; | 883 }; |
885 }); | 884 }); |
OLD | NEW |