Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Behavior for handling display layout, specifically | 6 * @fileoverview Behavior for handling display layout, specifically |
| 7 * edge snapping and collisions. | 7 * edge snapping and collisions. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 /** @polymerBehavior */ | 10 /** @polymerBehavior */ |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 } | 74 } |
| 75 }, | 75 }, |
| 76 | 76 |
| 77 /** | 77 /** |
| 78 * Called when a drag event occurs. Checks collisions and updates the layout. | 78 * Called when a drag event occurs. Checks collisions and updates the layout. |
| 79 * @param {string} id | 79 * @param {string} id |
| 80 * @param {!chrome.system.display.Bounds} newBounds The new calculated | 80 * @param {!chrome.system.display.Bounds} newBounds The new calculated |
| 81 * bounds for the display. | 81 * bounds for the display. |
| 82 * @return {!chrome.system.display.Bounds} | 82 * @return {!chrome.system.display.Bounds} |
| 83 */ | 83 */ |
| 84 updateDisplayBounds(id, newBounds) { | 84 updateDisplayBounds(id, newBounds) { |
|
dpapad
2016/11/23 01:48:51
I am confused by the mixing of ES6 and non-ES6 syn
stevenjb
2016/11/23 17:40:46
Oversight on my part. I wish we could enforce this
| |
| 85 this.dragLayoutId = id; | 85 this.dragLayoutId = id; |
| 86 if (this.displays.length < 2) { | |
|
dpapad
2016/11/23 01:48:51
Where is |this.displays| defined? Did not find it
stevenjb
2016/11/23 17:40:46
Ah, you're right, I should actually move this chec
| |
| 87 this.dragBounds_ = newBounds; | |
| 88 return newBounds; | |
| 89 } | |
| 86 | 90 |
| 87 // Find the closest parent. | 91 // Find the closest parent. |
| 88 var closestId = this.findClosest_(id, newBounds); | 92 var closestId = this.findClosest_(id, newBounds); |
| 89 | 93 |
| 90 // Find the closest edge. | 94 // Find the closest edge. |
| 91 var closestBounds = this.getCalculatedDisplayBounds(closestId); | 95 var closestBounds = this.getCalculatedDisplayBounds(closestId); |
| 92 var layoutPosition = | 96 var layoutPosition = |
| 93 this.getLayoutPositionForBounds_(newBounds, closestBounds); | 97 this.getLayoutPositionForBounds_(newBounds, closestBounds); |
| 94 | 98 |
| 95 // Snap to the closest edge. | 99 // Snap to the closest edge. |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 698 highlight == chrome.system.display.LayoutPosition.LEFT); | 702 highlight == chrome.system.display.LayoutPosition.LEFT); |
| 699 div.classList.toggle( | 703 div.classList.toggle( |
| 700 'highlight-top', | 704 'highlight-top', |
| 701 highlight == chrome.system.display.LayoutPosition.TOP); | 705 highlight == chrome.system.display.LayoutPosition.TOP); |
| 702 div.classList.toggle( | 706 div.classList.toggle( |
| 703 'highlight-bottom', | 707 'highlight-bottom', |
| 704 highlight == chrome.system.display.LayoutPosition.BOTTOM); | 708 highlight == chrome.system.display.LayoutPosition.BOTTOM); |
| 705 } | 709 } |
| 706 }, | 710 }, |
| 707 }; | 711 }; |
| OLD | NEW |