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

Unified Diff: chrome/browser/resources/settings/device_page/layout_behavior.js

Issue 2128773004: MD Settings: Display: Add mirroring and other fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_625106_settings_dropdown_style
Patch Set: Feedback Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/settings/device_page/display_layout.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/settings/device_page/layout_behavior.js
diff --git a/chrome/browser/resources/settings/device_page/layout_behavior.js b/chrome/browser/resources/settings/device_page/layout_behavior.js
index 51ba51bd83342f9380b855e19f5a23c19e4c0dcc..699be738b81f7ba687d65d0c8c20e3f89a10d9f3 100644
--- a/chrome/browser/resources/settings/device_page/layout_behavior.js
+++ b/chrome/browser/resources/settings/device_page/layout_behavior.js
@@ -15,6 +15,12 @@ var LayoutBehavior = {
* @type {!Array<!chrome.system.display.DisplayLayout>}
*/
layouts: Array,
+
+ /**
+ * Whether or not mirroring is enabled.
+ * @type {boolean}
+ */
+ mirroring: false,
},
/** @private {!Map<string, chrome.system.display.Bounds>} */
@@ -49,6 +55,8 @@ var LayoutBehavior = {
this.dragLayoutId = '';
this.dragParentId_ = '';
+ this.mirroring = displays.length > 0 && !!displays[0].mirroringSourceId;
+
this.displayBoundsMap_.clear();
for (let display of displays)
this.displayBoundsMap_.set(display.id, display.bounds);
@@ -182,11 +190,12 @@ var LayoutBehavior = {
/**
* @param {string} displayId
+ * @param {boolean=} opt_test
michaelpg 2016/07/11 20:41:56 i'd prefer optional params default to false, e.g.
stevenjb 2016/07/11 21:56:23 I inverted the variable to be notest instead. We c
* @return {!chrome.system.display.Bounds} bounds
*/
- getCalculatedDisplayBounds: function(displayId) {
+ getCalculatedDisplayBounds: function(displayId, opt_test) {
var bounds = this.calculatedBoundsMap_.get(displayId);
- assert(bounds);
+ assert(opt_test === false || bounds);
return bounds;
},
@@ -308,7 +317,7 @@ var LayoutBehavior = {
calculateBounds_: function(id, width, height) {
var left, top;
var layout = this.displayLayoutMap_.get(id);
- if (!layout || !layout.parentId) {
+ if (this.mirroring || !layout || !layout.parentId) {
left = -width / 2;
top = -height / 2;
} else {
« no previous file with comments | « chrome/browser/resources/settings/device_page/display_layout.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698