| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Crop mode. | 8 * Crop mode. |
| 9 * | 9 * |
| 10 * @extends {ImageEditor.Mode} | 10 * @extends {ImageEditor.Mode} |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 */ | 276 */ |
| 277 this.bounds_ = {}; | 277 this.bounds_ = {}; |
| 278 this.bounds_[DraggableRect.LEFT] = rect.left; | 278 this.bounds_[DraggableRect.LEFT] = rect.left; |
| 279 this.bounds_[DraggableRect.RIGHT] = rect.left + rect.width; | 279 this.bounds_[DraggableRect.RIGHT] = rect.left + rect.width; |
| 280 this.bounds_[DraggableRect.TOP] = rect.top; | 280 this.bounds_[DraggableRect.TOP] = rect.top; |
| 281 this.bounds_[DraggableRect.BOTTOM] = rect.top + rect.height; | 281 this.bounds_[DraggableRect.BOTTOM] = rect.top + rect.height; |
| 282 | 282 |
| 283 /** | 283 /** |
| 284 * Viewport. | 284 * Viewport. |
| 285 * | 285 * |
| 286 * @param {Viewport} | 286 * @type {Viewport} |
| 287 * @private | 287 * @private |
| 288 */ | 288 */ |
| 289 this.viewport_ = viewport; | 289 this.viewport_ = viewport; |
| 290 | 290 |
| 291 /** | 291 /** |
| 292 * Drag mode. | 292 * Drag mode. |
| 293 * | 293 * |
| 294 * @type {Object} | 294 * @type {Object} |
| 295 * @private | 295 * @private |
| 296 */ | 296 */ |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 switch (mode.ySide) { | 462 switch (mode.ySide) { |
| 463 case 'top': ySymbol = 'n'; break; | 463 case 'top': ySymbol = 'n'; break; |
| 464 case 'bottom': ySymbol = 's'; break; | 464 case 'bottom': ySymbol = 's'; break; |
| 465 } | 465 } |
| 466 return ySymbol + xSymbol + '-resize'; | 466 return ySymbol + xSymbol + '-resize'; |
| 467 }; | 467 }; |
| 468 | 468 |
| 469 /** | 469 /** |
| 470 * Obtains the drag handler depending on the coordinate. | 470 * Obtains the drag handler depending on the coordinate. |
| 471 * | 471 * |
| 472 * @param {number} startScreenX X coordinate for cursor in the screen. | 472 * @param {number} initialScreenX X coordinate for cursor in the screen. |
| 473 * @param {number} startScreenY Y coordinate for cursor in the screen. | 473 * @param {number} initialScreenY Y coordinate for cursor in the screen. |
| 474 * @param {boolean} touch Whether the operation is done by touch or not. | 474 * @param {boolean} touch Whether the operation is done by touch or not. |
| 475 * @return {function(number,number,boolean)} Drag handler that takes x | 475 * @return {function(number,number,boolean)} Drag handler that takes x |
| 476 * coordinate value, y coordinate value, and shift key flag. | 476 * coordinate value, y coordinate value, and shift key flag. |
| 477 */ | 477 */ |
| 478 DraggableRect.prototype.getDragHandler = function( | 478 DraggableRect.prototype.getDragHandler = function( |
| 479 initialScreenX, initialScreenY, touch) { | 479 initialScreenX, initialScreenY, touch) { |
| 480 // Check if the initial coordinate in the clip rect. | 480 // Check if the initial coordinate in the clip rect. |
| 481 var initialX = this.viewport_.screenToImageX(initialScreenX); | 481 var initialX = this.viewport_.screenToImageX(initialScreenX); |
| 482 var initialY = this.viewport_.screenToImageY(initialScreenY); | 482 var initialY = this.viewport_.screenToImageY(initialScreenY); |
| 483 var initialWidth = this.bounds_.right - this.bounds_.left; | 483 var initialWidth = this.bounds_.right - this.bounds_.left; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 break; | 663 break; |
| 664 case 'bottom': | 664 case 'bottom': |
| 665 this.bounds_.bottom = this.bounds_.top + newHeight; | 665 this.bounds_.bottom = this.bounds_.top + newHeight; |
| 666 break; | 666 break; |
| 667 case 'none': | 667 case 'none': |
| 668 this.bounds_.top = middle - newHeight / 2; | 668 this.bounds_.top = middle - newHeight / 2; |
| 669 this.bounds_.bottom = middle + newHeight / 2; | 669 this.bounds_.bottom = middle + newHeight / 2; |
| 670 break; | 670 break; |
| 671 } | 671 } |
| 672 }; | 672 }; |
| OLD | NEW |