| 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.exportPath('options'); | 5 cr.exportPath('options'); |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @typedef {{ | 8 * @typedef {{ |
| 9 * availableColorProfiles: Array<{profileId: number, name: string}>, | 9 * availableColorProfiles: Array<{profileId: number, name: string}>, |
| 10 * colorProfile: number, | 10 * colorProfile: number, |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 // Offset is calculated from top or left edge. | 368 // Offset is calculated from top or left edge. |
| 369 var primary = this.primaryDisplay_; | 369 var primary = this.primaryDisplay_; |
| 370 var secondary = this.secondaryDisplay_; | 370 var secondary = this.secondaryDisplay_; |
| 371 var offset; | 371 var offset; |
| 372 if (this.layout_ == options.SecondaryDisplayLayout.LEFT || | 372 if (this.layout_ == options.SecondaryDisplayLayout.LEFT || |
| 373 this.layout_ == options.SecondaryDisplayLayout.RIGHT) { | 373 this.layout_ == options.SecondaryDisplayLayout.RIGHT) { |
| 374 offset = secondary.div.offsetTop - primary.div.offsetTop; | 374 offset = secondary.div.offsetTop - primary.div.offsetTop; |
| 375 } else { | 375 } else { |
| 376 offset = secondary.div.offsetLeft - primary.div.offsetLeft; | 376 offset = secondary.div.offsetLeft - primary.div.offsetLeft; |
| 377 } | 377 } |
| 378 chrome.send('setDisplayLayout', | 378 offset = Math.floor(offset / this.visualScale_); |
| 379 [this.layout_, offset / this.visualScale_]); | 379 chrome.send('setDisplayLayout', [secondary.id, this.layout_, offset]); |
| 380 }, | 380 }, |
| 381 | 381 |
| 382 /** | 382 /** |
| 383 * Snaps the region [point, width] to [basePoint, baseWidth] if | 383 * Snaps the region [point, width] to [basePoint, baseWidth] if |
| 384 * the [point, width] is close enough to the base's edge. | 384 * the [point, width] is close enough to the base's edge. |
| 385 * @param {number} point The starting point of the region. | 385 * @param {number} point The starting point of the region. |
| 386 * @param {number} width The width of the region. | 386 * @param {number} width The width of the region. |
| 387 * @param {number} basePoint The starting point of the base region. | 387 * @param {number} basePoint The starting point of the base region. |
| 388 * @param {number} baseWidth The width of the base region. | 388 * @param {number} baseWidth The width of the base region. |
| 389 * @return {number} The moved point. Returns point itself if it doesn't | 389 * @return {number} The moved point. Returns point itself if it doesn't |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 mode, displays, layout, offset) { | 1045 mode, displays, layout, offset) { |
| 1046 DisplayOptions.getInstance().onDisplayChanged_( | 1046 DisplayOptions.getInstance().onDisplayChanged_( |
| 1047 mode, displays, layout, offset); | 1047 mode, displays, layout, offset); |
| 1048 }; | 1048 }; |
| 1049 | 1049 |
| 1050 // Export | 1050 // Export |
| 1051 return { | 1051 return { |
| 1052 DisplayOptions: DisplayOptions | 1052 DisplayOptions: DisplayOptions |
| 1053 }; | 1053 }; |
| 1054 }); | 1054 }); |
| OLD | NEW |