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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 if (point.y > bottomUpIntercept - point.x * diagonalSlope) | 67 if (point.y > bottomUpIntercept - point.x * diagonalSlope) |
68 return SecondaryDisplayLayout.RIGHT; | 68 return SecondaryDisplayLayout.RIGHT; |
69 else | 69 else |
70 return SecondaryDisplayLayout.TOP; | 70 return SecondaryDisplayLayout.TOP; |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 /** | 74 /** |
75 * Encapsulated handling of the 'Display' page. | 75 * Encapsulated handling of the 'Display' page. |
76 * @constructor | 76 * @constructor |
| 77 * @extends {cr.ui.pageManager.Page} |
77 */ | 78 */ |
78 function DisplayOptions() { | 79 function DisplayOptions() { |
79 Page.call(this, 'display', | 80 Page.call(this, 'display', |
80 loadTimeData.getString('displayOptionsPageTabTitle'), | 81 loadTimeData.getString('displayOptionsPageTabTitle'), |
81 'display-options-page'); | 82 'display-options-page'); |
82 } | 83 } |
83 | 84 |
84 cr.addSingletonGetter(DisplayOptions); | 85 cr.addSingletonGetter(DisplayOptions); |
85 | 86 |
86 DisplayOptions.prototype = { | 87 DisplayOptions.prototype = { |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 SecondaryDisplayLayout.TOP : SecondaryDisplayLayout.BOTTOM; | 395 SecondaryDisplayLayout.TOP : SecondaryDisplayLayout.BOTTOM; |
395 else if (newPosition.y + draggingDiv.offsetHeight < | 396 else if (newPosition.y + draggingDiv.offsetHeight < |
396 baseDiv.offsetTop) | 397 baseDiv.offsetTop) |
397 this.layout_ = this.dragging_.display.isPrimary ? | 398 this.layout_ = this.dragging_.display.isPrimary ? |
398 SecondaryDisplayLayout.BOTTOM : SecondaryDisplayLayout.TOP; | 399 SecondaryDisplayLayout.BOTTOM : SecondaryDisplayLayout.TOP; |
399 } else { | 400 } else { |
400 if (newPosition.x > baseDiv.offsetLeft + baseDiv.offsetWidth) | 401 if (newPosition.x > baseDiv.offsetLeft + baseDiv.offsetWidth) |
401 this.layout_ = this.dragging_.display.isPrimary ? | 402 this.layout_ = this.dragging_.display.isPrimary ? |
402 SecondaryDisplayLayout.LEFT : SecondaryDisplayLayout.RIGHT; | 403 SecondaryDisplayLayout.LEFT : SecondaryDisplayLayout.RIGHT; |
403 else if (newPosition.x + draggingDiv.offsetWidth < | 404 else if (newPosition.x + draggingDiv.offsetWidth < |
404 baseDiv.offstLeft) | 405 baseDiv.offsetLeft) |
405 this.layout_ = this.dragging_.display.isPrimary ? | 406 this.layout_ = this.dragging_.display.isPrimary ? |
406 SecondaryDisplayLayout.RIGHT : SecondaryDisplayLayout.LEFT; | 407 SecondaryDisplayLayout.RIGHT : SecondaryDisplayLayout.LEFT; |
407 } | 408 } |
408 | 409 |
409 var layoutToBase; | 410 var layoutToBase; |
410 if (!this.dragging_.display.isPrimary) { | 411 if (!this.dragging_.display.isPrimary) { |
411 layoutToBase = this.layout_; | 412 layoutToBase = this.layout_; |
412 } else { | 413 } else { |
413 switch (this.layout_) { | 414 switch (this.layout_) { |
414 case SecondaryDisplayLayout.RIGHT: | 415 case SecondaryDisplayLayout.RIGHT: |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 mirroring, displays, layout, offset) { | 873 mirroring, displays, layout, offset) { |
873 DisplayOptions.getInstance().onDisplayChanged_( | 874 DisplayOptions.getInstance().onDisplayChanged_( |
874 mirroring, displays, layout, offset); | 875 mirroring, displays, layout, offset); |
875 }; | 876 }; |
876 | 877 |
877 // Export | 878 // Export |
878 return { | 879 return { |
879 DisplayOptions: DisplayOptions | 880 DisplayOptions: DisplayOptions |
880 }; | 881 }; |
881 }); | 882 }); |
OLD | NEW |