| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * Class handling setting of the local app window shape to account for windows | 7 * Class handling setting of the local app window shape to account for windows |
| 8 * on the remote desktop, as well as any client-side UI. | 8 * on the remote desktop, as well as any client-side UI. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 desktop.right = Math.max(rect.left + rect.width, desktop.right); | 83 desktop.right = Math.max(rect.left + rect.width, desktop.right); |
| 84 desktop.top = Math.min(rect.top, desktop.top); | 84 desktop.top = Math.min(rect.top, desktop.top); |
| 85 desktop.bottom = Math.max(rect.top + rect.height, desktop.bottom); | 85 desktop.bottom = Math.max(rect.top + rect.height, desktop.bottom); |
| 86 }); | 86 }); |
| 87 } | 87 } |
| 88 | 88 |
| 89 // Center the element to the desktop window bounding rect. | 89 // Center the element to the desktop window bounding rect. |
| 90 var rect = element.getBoundingClientRect(); | 90 var rect = element.getBoundingClientRect(); |
| 91 var left = (desktop.right - desktop.left - rect.width) / 2 + desktop.left; | 91 var left = (desktop.right - desktop.left - rect.width) / 2 + desktop.left; |
| 92 var top = (desktop.bottom - desktop.top - rect.height) / 2 + desktop.top; | 92 var top = (desktop.bottom - desktop.top - rect.height) / 2 + desktop.top; |
| 93 element.style.left = left + 'px'; | 93 element.style.left = Math.round(left) + 'px'; |
| 94 element.style.top = top + 'px'; | 94 element.style.top = Math.round(top) + 'px'; |
| 95 this.updateClientWindowShape(); | 95 this.updateClientWindowShape(); |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 /** | 98 /** |
| 99 * Sets the region associated with the remote desktop windows. | 99 * Sets the region associated with the remote desktop windows. |
| 100 * | 100 * |
| 101 * @param {Array<{left: number, top: number, width: number, height: number}>} | 101 * @param {Array<{left: number, top: number, width: number, height: number}>} |
| 102 * rects | 102 * rects |
| 103 */ | 103 */ |
| 104 remoting.WindowShape.prototype.setDesktopRects = function(rects) { | 104 remoting.WindowShape.prototype.setDesktopRects = function(rects) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 * Adds the context menu's bounding rectangle to the specified region. | 143 * Adds the context menu's bounding rectangle to the specified region. |
| 144 * | 144 * |
| 145 * @param {Array<{left: number, top: number, width: number, height: number}>} | 145 * @param {Array<{left: number, top: number, width: number, height: number}>} |
| 146 * rects | 146 * rects |
| 147 */ | 147 */ |
| 148 remoting.WindowShape.ClientUI.prototype.addToRegion = function(rects) {}; | 148 remoting.WindowShape.ClientUI.prototype.addToRegion = function(rects) {}; |
| 149 | 149 |
| 150 | 150 |
| 151 /** @type {remoting.WindowShape} */ | 151 /** @type {remoting.WindowShape} */ |
| 152 remoting.windowShape = new remoting.WindowShape(); | 152 remoting.windowShape = new remoting.WindowShape(); |
| OLD | NEW |