Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: ui/file_manager/gallery/js/image_editor/image_transform.js

Issue 590073002: Gallery: Fix a beginning position gap of cropping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 var maxY = clipRect.top + clipRect.height; 516 var maxY = clipRect.top + clipRect.height;
517 517
518 // Returns a handler. 518 // Returns a handler.
519 return function(newScreenX, newScreenY, shiftKey) { 519 return function(newScreenX, newScreenY, shiftKey) {
520 var newX = this.viewport_.screenToImageX(newScreenX); 520 var newX = this.viewport_.screenToImageX(newScreenX);
521 var newY = this.viewport_.screenToImageY(newScreenY); 521 var newY = this.viewport_.screenToImageY(newScreenY);
522 522
523 // Check new crop. 523 // Check new crop.
524 if (this.dragMode_.newcrop) { 524 if (this.dragMode_.newcrop) {
525 this.dragMode_.newcrop = false; 525 this.dragMode_.newcrop = false;
526 this.bounds_.left = this.bounds_.right = newX; 526 this.bounds_.left = this.bounds_.right = initialX;
527 this.bounds_.top = this.bounds_.bottom = newY; 527 this.bounds_.top = this.bounds_.bottom = initialY;
528 mouseBiasX = 0; 528 mouseBiasX = 0;
529 mouseBiasY = 0; 529 mouseBiasY = 0;
530 } 530 }
531 531
532 // Update X coordinate. 532 // Update X coordinate.
533 if (this.dragMode_.xSide !== DraggableRect.NONE) { 533 if (this.dragMode_.xSide !== DraggableRect.NONE) {
534 this.bounds_[this.dragMode_.xSide] = 534 this.bounds_[this.dragMode_.xSide] =
535 ImageUtil.clamp(clipRect.left, newX + mouseBiasX, maxX); 535 ImageUtil.clamp(clipRect.left, newX + mouseBiasX, maxX);
536 if (this.bounds_.left > this.bounds_.right) { 536 if (this.bounds_.left > this.bounds_.right) {
537 var left = this.bounds_.left; 537 var left = this.bounds_.left;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698