@@ -234,7 +234,6 @@ define([
234
234
top ,
235
235
left ,
236
236
right ,
237
- bottom ,
238
237
ratio ;
239
238
240
239
if ( $ ( gallerySelector ) . data ( 'fotorama' ) . fullScreen ) {
@@ -255,11 +254,9 @@ define([
255
254
getLeftValue ( left , widthStep , dimensions . width , containerWidth ) : 0 ;
256
255
257
256
right = dragFlag && left < ( containerWidth - dimensions . width ) / 2 ? 0 : left ;
258
- bottom = dragFlag ? 0 : top ;
259
257
260
258
settings = $ . extend ( dimensions , {
261
259
top : top ,
262
- bottom : bottom ,
263
260
left : left ,
264
261
right : right
265
262
} ) ;
@@ -370,7 +367,7 @@ define([
370
367
return false ;
371
368
}
372
369
373
- function zoomOut ( e , xStep , yStep , fitIntoParentFlag = false ) {
370
+ function zoomOut ( e , xStep , yStep ) {
374
371
var $image ,
375
372
widthResult ,
376
373
heightResult ,
@@ -381,7 +378,8 @@ define([
381
378
imageHeight ,
382
379
zoomWidthStep ,
383
380
zoomHeightStep ,
384
- ratio ;
381
+ ratio ,
382
+ fitIntoParent ;
385
383
386
384
if ( allowZoomOut && ( ! transitionEnabled || ! transitionActive ) && ( isTouchEnabled ||
387
385
! $ ( zoomOutButtonSelector ) . hasClass ( zoomOutDisabled ) ) ) {
@@ -407,7 +405,7 @@ define([
407
405
zoomWidthStep = xStep || imageWidth - widthResult ;
408
406
}
409
407
410
- let fitIntoParent = function ( ) {
408
+ fitIntoParent = function ( ) {
411
409
if ( ratio > parentWidth / parentHeight ) {
412
410
widthResult = parentWidth ;
413
411
zoomWidthStep = imageWidth - widthResult ;
@@ -445,10 +443,7 @@ define([
445
443
checkFullscreenImagePosition ( $image , dimensions , zoomWidthStep , zoomHeightStep ) ;
446
444
} else {
447
445
toggleStandartNavigation ( ) ;
448
- if ( fitIntoParentFlag ) {
449
- allowZoomOut = dragFlag = false ;
450
- fitIntoParent ( ) ;
451
- }
446
+ fitIntoParent ( ) ;
452
447
}
453
448
} else if ( heightResult > parentHeight ) {
454
449
dimensions = {
@@ -463,11 +458,9 @@ define([
463
458
} ;
464
459
checkFullscreenImagePosition ( $image , dimensions , zoomWidthStep , zoomHeightStep ) ;
465
460
} else {
461
+ allowZoomOut = dragFlag = false ;
466
462
toggleStandartNavigation ( ) ;
467
- if ( fitIntoParentFlag ) {
468
- allowZoomOut = dragFlag = false ;
469
- fitIntoParent ( ) ;
470
- }
463
+ fitIntoParent ( ) ;
471
464
}
472
465
}
473
466
@@ -535,7 +528,8 @@ define([
535
528
$imageContainer = $ ( '[data-gallery-role="stage-shaft"] [data-active="true"]' ) ,
536
529
gallery = $gallery . data ( 'fotorama' ) ,
537
530
evCache = [ ] ,
538
- prevDiff = - 1 ;
531
+ prevDiff = - 1 ,
532
+ preventAction = false ;
539
533
540
534
swipeSlide = _ . throttle ( function ( direction ) {
541
535
$ ( gallerySelector ) . data ( 'fotorama' ) . show ( direction ) ;
@@ -631,10 +625,18 @@ define([
631
625
632
626
if ( prevDiff > 0 ) {
633
627
if ( curDiff - prevDiff > 0.2 && allowZoomIn ) {
628
+ preventAction = true ;
634
629
zoomIn ( ev , curDiff , curDiff ) ;
630
+ setTimeout ( ( ) => {
631
+ preventAction = false ;
632
+ } , 500 ) ;
635
633
}
636
634
if ( curDiff - prevDiff < - 0.2 && allowZoomOut ) {
635
+ preventAction = true ;
637
636
zoomOut ( ev , curDiff , curDiff ) ;
637
+ setTimeout ( ( ) => {
638
+ preventAction = false ;
639
+ } , 500 ) ;
638
640
}
639
641
}
640
642
@@ -678,12 +680,7 @@ define([
678
680
if ( allowZoomIn ) {
679
681
zoomIn ( e , imgOriginalSize . rw - $image . width ( ) , imgOriginalSize . rh - $image . height ( ) ) ;
680
682
} else if ( allowZoomOut ) {
681
- zoomOut (
682
- e ,
683
- imgOriginalSize . rw * proportions ,
684
- imgOriginalSize . rh - $imageContainer . height ( ) ,
685
- true
686
- ) ;
683
+ zoomOut ( e , imgOriginalSize . rw * proportions , imgOriginalSize . rh - $imageContainer . height ( ) ) ;
687
684
}
688
685
}
689
686
@@ -695,11 +692,15 @@ define([
695
692
const curTime = new Date ( ) . getTime ( ) ;
696
693
const tapLen = curTime - lastTap ;
697
694
698
- if ( tapLen < 500 && tapLen > 50 ) {
695
+ if ( tapLen < 300 && tapLen > 50 && ! preventAction ) {
699
696
event . preventDefault ( ) ;
700
697
701
698
transitionActive = false ;
699
+ preventAction = true ;
702
700
dblClickHandler ( event ) ;
701
+ setTimeout ( ( ) => {
702
+ preventAction = false ;
703
+ } , 500 ) ;
703
704
prevDiff = - 1 ;
704
705
} else {
705
706
timeout = setTimeout ( ( ) => {
0 commit comments