Commit 82d14192 authored by hirono@chromium.org's avatar hirono@chromium.org

Gallery: Add animation when zooming pictures.

BUG=245926
TEST=manually

Review URL: https://codereview.chromium.org/395083002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283519 0039d316-1c4b-4281-b951-d872f2087c98
parent 43a63273
...@@ -125,6 +125,17 @@ ImageView.prototype.draw = function() { ...@@ -125,6 +125,17 @@ ImageView.prototype.draw = function() {
} }
}; };
/**
* Applies the viewport change that does not affect the screen cache size (zoom
* change or offset change) with animation.
*/
ImageView.prototype.applyViewportChange = function() {
this.setTransform(
this.screenImage_,
new ImageView.Effect.None(),
ImageView.Effect.DEFAULT_DURATION);
};
/** /**
* @return {number} The cache generation. * @return {number} The cache generation.
*/ */
......
...@@ -98,7 +98,6 @@ Viewport.prototype.setZoomIndex = function(zoomIndex) { ...@@ -98,7 +98,6 @@ Viewport.prototype.setZoomIndex = function(zoomIndex) {
this.zoomIndex_ = zoomIndex; this.zoomIndex_ = zoomIndex;
this.zoom_ = Viewport.ZOOM_RATIOS[zoomIndex]; this.zoom_ = Viewport.ZOOM_RATIOS[zoomIndex];
this.invalidateCaches();
}; };
/** /**
......
...@@ -869,14 +869,14 @@ SlideMode.prototype.onKeyDown = function(event) { ...@@ -869,14 +869,14 @@ SlideMode.prototype.onKeyDown = function(event) {
case 'Ctrl-U+00BB': // Ctrl+'=' zoom in. case 'Ctrl-U+00BB': // Ctrl+'=' zoom in.
if (!this.isEditing()) { if (!this.isEditing()) {
this.viewport_.setZoomIndex(this.viewport_.getZoomIndex() + 1); this.viewport_.setZoomIndex(this.viewport_.getZoomIndex() + 1);
this.imageView_.draw(); this.imageView_.applyViewportChange();
} }
break; break;
case 'Ctrl-U+00BD': // Ctrl+'-' zoom out. case 'Ctrl-U+00BD': // Ctrl+'-' zoom out.
if (!this.isEditing()) { if (!this.isEditing()) {
this.viewport_.setZoomIndex(this.viewport_.getZoomIndex() - 1); this.viewport_.setZoomIndex(this.viewport_.getZoomIndex() - 1);
this.imageView_.draw(); this.imageView_.applyViewportChange();
} }
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment