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 OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
7 | 7 |
8 // The scale ratio of the display rectangle to its original size. | 8 // The scale ratio of the display rectangle to its original size. |
9 /** @const */ var VISUAL_SCALE = 1 / 10; | 9 /** @const */ var VISUAL_SCALE = 1 / 10; |
10 | 10 |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 /** | 828 /** |
829 * Updates the description of the selected display section. | 829 * Updates the description of the selected display section. |
830 * @private | 830 * @private |
831 */ | 831 */ |
832 updateSelectedDisplayDescription_: function() { | 832 updateSelectedDisplayDescription_: function() { |
833 if (this.focusedIndex_ == null || | 833 if (this.focusedIndex_ == null || |
834 this.displays_[this.focusedIndex_] == null) { | 834 this.displays_[this.focusedIndex_] == null) { |
835 $('selected-display-data-container').hidden = true; | 835 $('selected-display-data-container').hidden = true; |
836 $('display-configuration-arrow').hidden = true; | 836 $('display-configuration-arrow').hidden = true; |
837 $('display-options-set-primary').hidden = true; | 837 $('display-options-set-primary').hidden = true; |
| 838 $('display-options-toggle-mirroring').hidden = true; |
838 return; | 839 return; |
839 } | 840 } |
840 | 841 |
841 $('selected-display-data-container').hidden = false; | 842 $('selected-display-data-container').hidden = false; |
842 var display = this.displays_[this.focusedIndex_]; | 843 var display = this.displays_[this.focusedIndex_]; |
843 var nameElement = $('selected-display-name'); | 844 var nameElement = $('selected-display-name'); |
844 while (nameElement.childNodes.length > 0) | 845 while (nameElement.childNodes.length > 0) |
845 nameElement.removeChild(nameElement.firstChild); | 846 nameElement.removeChild(nameElement.firstChild); |
846 nameElement.appendChild(document.createTextNode(display.name)); | 847 nameElement.appendChild(document.createTextNode(display.name)); |
847 | 848 |
(...skipping 18 matching lines...) Expand all Loading... |
866 arrow.hidden = false; | 867 arrow.hidden = false; |
867 // Adding 1 px to the position to fit the border line and the border in | 868 // Adding 1 px to the position to fit the border line and the border in |
868 // arrow precisely. | 869 // arrow precisely. |
869 arrow.style.top = $('display-configurations').offsetTop - | 870 arrow.style.top = $('display-configurations').offsetTop - |
870 arrow.offsetHeight / 2 + 1 + 'px'; | 871 arrow.offsetHeight / 2 + 1 + 'px'; |
871 arrow.style.left = display.div.offsetLeft + display.div.offsetWidth / 2 - | 872 arrow.style.left = display.div.offsetLeft + display.div.offsetWidth / 2 - |
872 arrow.offsetWidth / 2 + 'px'; | 873 arrow.offsetWidth / 2 + 'px'; |
873 | 874 |
874 $('display-options-set-primary').hidden = | 875 $('display-options-set-primary').hidden = |
875 this.displays_[this.focusedIndex_].isPrimary; | 876 this.displays_[this.focusedIndex_].isPrimary; |
| 877 $('display-options-toggle-mirroring').hidden = |
| 878 (this.displays_.length <= 1); |
876 }, | 879 }, |
877 | 880 |
878 /** | 881 /** |
879 * Clears the drawing area for display rectangles. | 882 * Clears the drawing area for display rectangles. |
880 * @private | 883 * @private |
881 */ | 884 */ |
882 resetDisplaysView_: function() { | 885 resetDisplaysView_: function() { |
883 var displaysViewHost = $('display-options-displays-view-host'); | 886 var displaysViewHost = $('display-options-displays-view-host'); |
884 displaysViewHost.removeChild(displaysViewHost.firstChild); | 887 displaysViewHost.removeChild(displaysViewHost.firstChild); |
885 this.displaysView_ = document.createElement('div'); | 888 this.displaysView_ = document.createElement('div'); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 mirroring, displays, layout, offset) { | 1090 mirroring, displays, layout, offset) { |
1088 DisplayOptions.getInstance().onDisplayChanged_( | 1091 DisplayOptions.getInstance().onDisplayChanged_( |
1089 mirroring, displays, layout, offset); | 1092 mirroring, displays, layout, offset); |
1090 }; | 1093 }; |
1091 | 1094 |
1092 // Export | 1095 // Export |
1093 return { | 1096 return { |
1094 DisplayOptions: DisplayOptions | 1097 DisplayOptions: DisplayOptions |
1095 }; | 1098 }; |
1096 }); | 1099 }); |
OLD | NEW |