diff options
author | mtomasz@chromium.org <mtomasz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-09 04:09:53 +0000 |
---|---|---|
committer | mtomasz@chromium.org <mtomasz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-09 04:09:53 +0000 |
commit | f1c9b58845aa83a3c9e74a9ba960d7745c5fc1dc (patch) | |
tree | 1730745c793d73b9b1db096541526268e92c5e44 | |
parent | f4964d06300867cefe7174d306c557c615b0fec7 (diff) | |
download | chromium_src-f1c9b58845aa83a3c9e74a9ba960d7745c5fc1dc.zip chromium_src-f1c9b58845aa83a3c9e74a9ba960d7745c5fc1dc.tar.gz chromium_src-f1c9b58845aa83a3c9e74a9ba960d7745c5fc1dc.tar.bz2 |
Fix the crop tool when resizing.
The crop rectangle has to be updated when resizing the window. This patch does that by listening to the onresize event within the cropping tool class.
TEST=Tested manually. Open a picture, try to crop. Then resize the window. The crop rectangle should reflect the new window size.
BUG=284946
Review URL: https://codereview.chromium.org/26445002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227668 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/resources/file_manager/js/image_editor/image_transform.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/chrome/browser/resources/file_manager/js/image_editor/image_transform.js b/chrome/browser/resources/file_manager/js/image_editor/image_transform.js index de8409f..6b194ba 100644 --- a/chrome/browser/resources/file_manager/js/image_editor/image_transform.js +++ b/chrome/browser/resources/file_manager/js/image_editor/image_transform.js @@ -67,10 +67,21 @@ ImageEditor.Mode.Crop.prototype.setUp = function() { addCropFrame('bottom horizontal'); addCropFrame('right bottom corner'); + this.onResizedBound_ = this.onResized_.bind(this); + window.addEventListener('resize', this.onResizedBound_); + this.createDefaultCrop(); }; /** + * Handles resizing of the window and updates the crop rectangle. + * @private + */ +ImageEditor.Mode.Crop.prototype.onResized_ = function() { + this.positionDOM(); +}; + +/** * TODO(JSDOC). */ ImageEditor.Mode.Crop.prototype.reset = function() { @@ -114,6 +125,8 @@ ImageEditor.Mode.Crop.prototype.cleanUpUI = function() { this.domOverlay_.parentNode.removeChild(this.domOverlay_); this.domOverlay_ = null; this.editor_.hideOverlappingTools(); + window.removeEventListener(this.onResizedBound_); + this.onResizedBound_ = null; }; /** |