@@ -30,6 +30,7 @@ define([
30
30
dragFlag ,
31
31
endX ,
32
32
transitionActive = false ,
33
+ tapFlag = 0 ,
33
34
allowZoomOut = false ,
34
35
allowZoomIn = true ;
35
36
@@ -112,7 +113,7 @@ define([
112
113
113
114
function resetVars ( $image ) {
114
115
allowZoomIn = true ;
115
- allowZoomOut = dragFlag = false ;
116
+ allowZoomOut = dragFlag = transitionActive = false ;
116
117
$image . hasClass ( imageDraggableClass ) && $image . removeClass ( imageDraggableClass ) ;
117
118
toggleZoomable ( $image , false ) ;
118
119
}
@@ -593,6 +594,17 @@ define([
593
594
}
594
595
}
595
596
597
+ function detectDoubleTap ( e ) {
598
+ var now = new Date ( ) . getTime ( ) ,
599
+ timesince = now - tapFlag ;
600
+
601
+ if ( timesince < 500 && timesince > 0 ) {
602
+ transitionActive = false ;
603
+ dblClickHandler ( e ) ;
604
+ }
605
+ tapFlag = new Date ( ) . getTime ( ) ;
606
+ }
607
+
596
608
$image . unbind ( 'dblclick' ) ;
597
609
$image . dblclick ( dblClickHandler ) ;
598
610
@@ -763,6 +775,13 @@ define([
763
775
}
764
776
} ) ;
765
777
778
+ isTouchEnabled && $image . off ( 'touchend' ) ;
779
+ isTouchEnabled && $image . on ( 'touchend' , function ( e ) {
780
+ if ( e . originalEvent . touches . length === 0 ) {
781
+ detectDoubleTap ( e ) ;
782
+ }
783
+ } ) ;
784
+
766
785
$ ( window ) . resize ( function ( ) {
767
786
toggleZoomButtons ( $image , isTouchEnabled , checkForVideo ( fotorama . activeFrame . $stageFrame ) ) ;
768
787
calculateMinSize ( $image ) ;
0 commit comments