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

Unified Diff: ui/file_manager/gallery/js/image_editor/viewport.js

Issue 1294303003: Gallery: fix coordinate calculation of viewport.js. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/gallery/js/image_editor/viewport.js
diff --git a/ui/file_manager/gallery/js/image_editor/viewport.js b/ui/file_manager/gallery/js/image_editor/viewport.js
index 8be7a59b7df8a8c6c421eed80df39bb66bdd1f12..12b868dfacb7a8c7efef6428df128015610413a2 100644
--- a/ui/file_manager/gallery/js/image_editor/viewport.js
+++ b/ui/file_manager/gallery/js/image_editor/viewport.js
@@ -448,9 +448,10 @@ Viewport.prototype.imageToScreenRect = function(rect) {
*/
Viewport.prototype.getCenteredRect_ = function(
width, height, offsetX, offsetY) {
+ var screenBounds = this.getScreenBounds();
return new ImageRect(
- ~~((this.getScreenBounds().width - width) / 2) + offsetX,
- ~~((this.getScreenBounds().height - height) / 2) + offsetY,
+ ~~((screenBounds.width - width) / 2) + offsetX,
+ ~~((screenBounds.height - height) / 2) + screenBounds.top + offsetY,
width,
height);
};
@@ -497,7 +498,6 @@ Viewport.prototype.update_ = function() {
// Image bounds on screen.
this.imageBoundsOnScreen_ = this.getCenteredRect_(
zoomedWidht, zoomedHeight, this.offsetX_, this.offsetY_);
- this.imageBoundsOnScreen_.top += this.screenTop_;
// Image bounds of element (that is not applied zoom and offset) on screen.
var oldBounds = this.imageElementBoundsOnScreen_;
@@ -610,7 +610,7 @@ Viewport.prototype.getTransformation = function(width, height, opt_dx) {
this.rotation_,
this.zoom_,
this.offsetX_ + (opt_dx || 0),
- this.offsetY_ + this.screenTop_);
+ this.offsetY_);
};
/**
« 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