Skip to content

Commit

Permalink
Merge pull request #77 from ValeryYafremau/JS-369
Browse files Browse the repository at this point in the history
JS-369: Image zoom animation doesn't work smoothly
  • Loading branch information
uharbachou1 committed Dec 15, 2015
2 parents 9e58c11 + 9b72c4e commit b50552a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/web/magnifier/magnify.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ define([
hideMagnifier,
dragFlag,
endX,
transitionActive = false,
allowZoomOut = false,
allowZoomIn = true;

Expand Down Expand Up @@ -201,6 +202,7 @@ define([
ratio;

if ($(gallerySelector).data('fotorama').fullScreen) {
transitionActive = true;
$imageContainer = $image.parent();
containerWidth = $imageContainer.width();
containerHeight = $imageContainer.height();
Expand Down Expand Up @@ -272,7 +274,7 @@ define([
ratio,
dimentions = {};

if (allowZoomIn) {
if (allowZoomIn && !transitionActive) {

$image = $(fullscreenImageSelector);
imgOriginalSize = getImageSize($image[0].src);
Expand Down Expand Up @@ -345,7 +347,7 @@ define([
ratio,
fitIntoParent;

if (allowZoomOut) {
if (allowZoomOut && !transitionActive) {
allowZoomIn = true;
$image = $(fullscreenImageSelector);
parentWidth = $image.parent().width();
Expand Down Expand Up @@ -674,6 +676,11 @@ define([
}
});

$image.off('transitionend webkitTransitionEnd');
$image.on('transitionend webkitTransitionEnd', function () {
transitionActive = false;
});

if (keyboardNavigation) {
$(document).unbind('keydown', keyboardNavigation);
}
Expand Down

0 comments on commit b50552a

Please sign in to comment.