| 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 |    6  * @fileoverview | 
|    7  * 'display-layout' presents a visual representation of the layout of one or |    7  * 'display-layout' presents a visual representation of the layout of one or | 
|    8  * more displays and allows them to be arranged. |    8  * more displays and allows them to be arranged. | 
|    9  */ |    9  */ | 
|   10  |   10  | 
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  172    * @param {!chrome.system.display.DisplayUnitInfo} selectedDisplay |  172    * @param {!chrome.system.display.DisplayUnitInfo} selectedDisplay | 
|  173    * @return {boolean} |  173    * @return {boolean} | 
|  174    * @private |  174    * @private | 
|  175    */ |  175    */ | 
|  176   isSelected_: function(display, selectedDisplay) { |  176   isSelected_: function(display, selectedDisplay) { | 
|  177     return display.id == selectedDisplay.id; |  177     return display.id == selectedDisplay.id; | 
|  178   }, |  178   }, | 
|  179  |  179  | 
|  180   /** |  180   /** | 
|  181    * @param {!{model: !{item: !chrome.system.display.DisplayUnitInfo}, |  181    * @param {!{model: !{item: !chrome.system.display.DisplayUnitInfo}, | 
|  182    *     target: !PaperButtonElement}} e |  182    *     target: !HTMLDivElement}} e | 
|  183    * @private |  183    * @private | 
|  184    */ |  184    */ | 
|  185   onSelectDisplayTap_: function(e) { |  185   onSelectDisplayTap_: function(e) { | 
|  186     this.fire('select-display', e.model.item.id); |  186     this.fire('select-display', e.model.item.id); | 
|  187     // Force active in case the selected display was clicked. |  187     // Force active in case the selected display was clicked. | 
 |  188     // TODO(dpapad): Ask @stevenjb, why are we setting 'active' on a div? | 
|  188     e.target.active = true; |  189     e.target.active = true; | 
|  189   }, |  190   }, | 
|  190  |  191  | 
|  191   /** |  192   /** | 
|  192    * @param {string} id |  193    * @param {string} id | 
|  193    * @param {?DragPosition} amount |  194    * @param {?DragPosition} amount | 
|  194    */ |  195    */ | 
|  195   onDrag_(id, amount) { |  196   onDrag_: function(id, amount) { | 
|  196     id = id.substr(1);  // Skip prefix |  197     id = id.substr(1);  // Skip prefix | 
|  197  |  198  | 
|  198     var newBounds; |  199     var newBounds; | 
|  199     if (!amount) { |  200     if (!amount) { | 
|  200       this.finishUpdateDisplayBounds(id); |  201       this.finishUpdateDisplayBounds(id); | 
|  201       newBounds = this.getCalculatedDisplayBounds(id); |  202       newBounds = this.getCalculatedDisplayBounds(id); | 
|  202     } else { |  203     } else { | 
|  203       // Make sure the dragged display is also selected. |  204       // Make sure the dragged display is also selected. | 
|  204       if (id != this.selectedDisplay.id) |  205       if (id != this.selectedDisplay.id) | 
|  205         this.fire('select-display', id); |  206         this.fire('select-display', id); | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
|  217     var top = |  218     var top = | 
|  218         this.visualOffset_.top + Math.round(newBounds.top * this.visualScale); |  219         this.visualOffset_.top + Math.round(newBounds.top * this.visualScale); | 
|  219     var div = this.$$('#_' + id); |  220     var div = this.$$('#_' + id); | 
|  220     div.style.left = '' + left + 'px'; |  221     div.style.left = '' + left + 'px'; | 
|  221     div.style.top = '' + top + 'px'; |  222     div.style.top = '' + top + 'px'; | 
|  222   }, |  223   }, | 
|  223  |  224  | 
|  224 }); |  225 }); | 
|  225  |  226  | 
|  226 })(); |  227 })(); | 
| OLD | NEW |