Chromium Code Reviews| Index: ui/file_manager/gallery/js/image_editor/commands.js |
| diff --git a/ui/file_manager/gallery/js/image_editor/commands.js b/ui/file_manager/gallery/js/image_editor/commands.js |
| index a63801b2c37b8a207a0a907ecd7e6c34583ecfe3..182a7142c59d556c1d69a447806df2bd398dad68 100644 |
| --- a/ui/file_manager/gallery/js/image_editor/commands.js |
| +++ b/ui/file_manager/gallery/js/image_editor/commands.js |
| @@ -450,3 +450,37 @@ Command.Filter.prototype.execute = function( |
| filter.applyByStrips(result, srcImage, this.filter_, |
| uiContext.imageView ? onProgressVisible : onProgressInvisible); |
| }; |
| + |
| +/** |
| + * ImagResize Command |
| + * @param {number} inputWidth width user input |
| + * @param {number} inputHeight height user input |
| + * @constructor |
| + * @extends {Command} |
| + * @struct |
| + */ |
| +Command.ImageResize = function(inputWidth, inputHeight) { |
|
fukino
2016/08/31 05:10:24
Command.Resize sounds more consistent with Command
harukam
2016/09/05 10:37:00
Agree. Thanks! done.
|
| + Command.call(this, 'imageResize(x:' + inputWidth + ',y:' + inputHeight + ')'); |
| + this.newWidth_ = inputWidth; |
| + this.newHeight_ = inputHeight; |
| +}; |
| + |
| +Command.ImageResize.prototype = {__proto__: Command.prototype}; |
| + |
| +/** @override */ |
| +Command.ImageResize.prototype.execute = function( |
| + document, srcImage, callback, uiContext) { |
| + var result = this.createCanvas_( |
| + document, |
|
fukino
2016/08/31 05:10:24
4 spaces indent.
harukam
2016/09/05 10:37:00
Done.
|
| + srcImage, |
|
fukino
2016/08/31 05:10:24
All arguments can be fit in one line.
harukam
2016/09/05 10:37:00
Done.
|
| + this.newWidth_, |
| + this.newHeight_); |
| + |
| + var scaleX = this.newWidth_ / srcImage.width; |
| + var scaleY = this.newHeight_ / srcImage.height; |
| + ImageUtil.drawImageTransformed(result, srcImage, scaleX, scaleY, 0); |
| + |
| + if(uiContext.imageView) |
| + uiContext.imageView.replace(result); |
| + callback(result); |
| +}; |