| Index: chrome/browser/resources/file_manager/js/image_editor/viewport.js
|
| diff --git a/chrome/browser/resources/file_manager/js/image_editor/viewport.js b/chrome/browser/resources/file_manager/js/image_editor/viewport.js
|
| index 0c1f9c07009de8b352f1d617d9e0148fb9fd3680..d41cb88b836d65345c02ddb91c2b4e42ed9b94c1 100644
|
| --- a/chrome/browser/resources/file_manager/js/image_editor/viewport.js
|
| +++ b/chrome/browser/resources/file_manager/js/image_editor/viewport.js
|
| @@ -213,7 +213,7 @@ Viewport.prototype.isClipped = function () {
|
| * Horizontal margin. Negative if the image is clipped horizontally.
|
| */
|
| Viewport.prototype.getMarginX_ = function() {
|
| - return Math.floor(
|
| + return Math.round(
|
| (this.screenBounds_.width - this.imageBounds_.width * this.scale_) / 2);
|
| };
|
|
|
| @@ -221,17 +221,17 @@ Viewport.prototype.getMarginX_ = function() {
|
| * Vertical margin. Negative if the image is clipped vertically.
|
| */
|
| Viewport.prototype.getMarginY_ = function() {
|
| - return Math.floor(
|
| + return Math.round(
|
| (this.screenBounds_.height - this.imageBounds_.height * this.scale_) / 2);
|
| };
|
|
|
| Viewport.prototype.clampOffsetX_ = function(x) {
|
| - var limit = Math.max(0, -this.getMarginX_() / this.getScale());
|
| + var limit = Math.round(Math.max(0, -this.getMarginX_() / this.getScale()));
|
| return ImageUtil.clamp(-limit, x, limit);
|
| };
|
|
|
| Viewport.prototype.clampOffsetY_ = function(y) {
|
| - var limit = Math.max(0, -this.getMarginY_() / this.getScale());
|
| + var limit = Math.round(Math.max(0, -this.getMarginY_() / this.getScale()));
|
| return ImageUtil.clamp(-limit, y, limit);
|
| };
|
|
|
| @@ -245,8 +245,8 @@ Viewport.prototype.update = function() {
|
| this.imageOnScreen_ = new Rect(
|
| this.getMarginX_(),
|
| this.getMarginY_(),
|
| - Math.floor(this.imageBounds_.width * scale),
|
| - Math.floor(this.imageBounds_.height * scale));
|
| + Math.round(this.imageBounds_.width * scale),
|
| + Math.round(this.imageBounds_.height * scale));
|
|
|
| // A visible part of the image in image coordinates.
|
| this.imageClipped_ = new Rect(this.imageBounds_);
|
| @@ -256,18 +256,20 @@ Viewport.prototype.update = function() {
|
|
|
| // Adjust for the offset.
|
| if (this.imageOnScreen_.left < 0) {
|
| - this.imageOnScreen_.left += this.clampOffsetX_(this.offsetX_) * scale;
|
| - this.imageClipped_.left = -this.imageOnScreen_.left / scale;
|
| - this.imageClipped_.width = this.screenBounds_.width / scale;
|
| + this.imageOnScreen_.left +=
|
| + Math.round(this.clampOffsetX_(this.offsetX_) * scale);
|
| + this.imageClipped_.left = Math.round(-this.imageOnScreen_.left / scale);
|
| + this.imageClipped_.width = Math.round(this.screenBounds_.width / scale);
|
| } else {
|
| this.screenClipped_.left = this.imageOnScreen_.left;
|
| this.screenClipped_.width = this.imageOnScreen_.width;
|
| }
|
|
|
| if (this.imageOnScreen_.top < 0) {
|
| - this.imageOnScreen_.top += this.clampOffsetY_(this.offsetY_) * scale;
|
| - this.imageClipped_.top = -this.imageOnScreen_.top / scale;
|
| - this.imageClipped_.height = this.screenBounds_.height / scale;
|
| + this.imageOnScreen_.top +=
|
| + Math.round(this.clampOffsetY_(this.offsetY_) * scale);
|
| + this.imageClipped_.top = Math.round(-this.imageOnScreen_.top / scale);
|
| + this.imageClipped_.height = Math.round(this.screenBounds_.height / scale);
|
| } else {
|
| this.screenClipped_.top = this.imageOnScreen_.top;
|
| this.screenClipped_.height = this.imageOnScreen_.height;
|
|
|