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

Side by Side Diff: chrome/browser/resources/settings/device_page/display.js

Issue 2097763004: MD Settings: Display: Add snapping and collisions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_547080_display_settings8a_drag
Patch Set: Rebase + More 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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-display' is the settings subpage for display settings. 7 * 'settings-display' is the settings subpage for display settings.
8 */ 8 */
9 9
10 cr.define('settings.display', function() { 10 cr.define('settings.display', function() {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 var widthStr = mode.width.toString(); 226 var widthStr = mode.width.toString();
227 var heightStr = mode.height.toString(); 227 var heightStr = mode.height.toString();
228 if (best) 228 if (best)
229 return this.i18n('displayResolutionTextBest', widthStr, heightStr); 229 return this.i18n('displayResolutionTextBest', widthStr, heightStr);
230 else if (mode.isNative) 230 else if (mode.isNative)
231 return this.i18n('displayResolutionTextNative', widthStr, heightStr); 231 return this.i18n('displayResolutionTextNative', widthStr, heightStr);
232 return this.i18n('displayResolutionText', widthStr, heightStr); 232 return this.i18n('displayResolutionText', widthStr, heightStr);
233 }, 233 },
234 234
235 /** 235 /**
236 * @param {!{detail: number}} e 236 * @param {!{detail: string}} e |e.detail| is the id of the selected display.
237 * @private 237 * @private
238 */ 238 */
239 onSelectDisplay_: function(e) { 239 onSelectDisplay_: function(e) {
240 var index = e.detail; 240 var id = e.detail;
241 assert(index >= 0); 241 for (let display of this.displays) {
242 if (index >= this.displays.length) 242 if (id != display.id)
243 return; 243 continue;
244 this.selectedDisplay = this.displays[e.detail]; 244 this.selectedDisplay = display;
245 // Force active in case selected display was clicked. 245 }
246 e.target.active = true;
247 }, 246 },
248 247
249 /** @private */ 248 /** @private */
250 onMakePrimaryTap_: function() { 249 onMakePrimaryTap_: function() {
251 if (!this.selectedDisplay) 250 if (!this.selectedDisplay)
252 return; 251 return;
253 if (this.selectedDisplay.id == this.primaryDisplayId) 252 if (this.selectedDisplay.id == this.primaryDisplayId)
254 return; 253 return;
255 /** @type {!chrome.system.display.DisplayProperties} */ var properties = { 254 /** @type {!chrome.system.display.DisplayProperties} */ var properties = {
256 isPrimary: true 255 isPrimary: true
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 }, 340 },
342 341
343 /** @private */ 342 /** @private */
344 setPropertiesCallback_: function() { 343 setPropertiesCallback_: function() {
345 if (chrome.runtime.lastError) { 344 if (chrome.runtime.lastError) {
346 console.error( 345 console.error(
347 'setDisplayProperties Error: ' + chrome.runtime.lastError.message); 346 'setDisplayProperties Error: ' + chrome.runtime.lastError.message);
348 } 347 }
349 }, 348 },
350 }); 349 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698