@@ -31,11 +31,10 @@ define([
31
31
endX ,
32
32
transitionEnabled ,
33
33
transitionActive = false ,
34
- tapFlag ,
34
+ tapFlag = 0 ,
35
35
allowZoomOut = false ,
36
36
allowZoomIn = true ;
37
37
38
- tapFlag = new Date ( ) . getTime ( ) ;
39
38
transitionEnabled = document . documentElement . style . transition !== undefined ||
40
39
document . documentElement . style . WebkitTransition !== undefined ||
41
40
document . documentElement . style . MozTransition !== undefined ||
@@ -521,6 +520,7 @@ define([
521
520
* Method which makes draggable picture. Also work on touch devices.
522
521
*/
523
522
function magnifierFullscreen ( fotorama ) {
523
+ tapFlag = new Date ( ) . getTime ( ) ;
524
524
var isDragActive = false ,
525
525
startX ,
526
526
startY ,
@@ -636,21 +636,21 @@ define([
636
636
}
637
637
638
638
function detectDoubleTap ( e ) {
639
- var now = new Date ( ) . getTime ( ) ,
639
+ let now = new Date ( ) . getTime ( ) ,
640
640
timesince = now - tapFlag ;
641
641
642
- if ( timesince < 2000 && timesince > 400 ) {
642
+ if ( timesince > 10 && ( isTouchEnabled && timesince < 400 ) || ( ! isTouchEnabled && timesince < 2000 ) ) {
643
643
transitionActive = false ;
644
644
dblClickHandler ( e ) ;
645
+ tapFlag = now ;
645
646
}
647
+
646
648
tapFlag = now ;
647
649
}
648
650
649
651
$image . off ( 'dblclick' ) ;
650
652
$image . on ( 'dblclick' , detectDoubleTap ) ;
651
- $image . on ( 'click' , function ( e ) {
652
- detectDoubleTap ( e ) ;
653
- } ) ;
653
+ $image . on ( 'touchend' , detectDoubleTap ) ;
654
654
655
655
if ( gallery . fullScreen ) {
656
656
toggleZoomButtons ( $image , isTouchEnabled , checkForVideo ( fotorama . activeFrame . $stageFrame ) ) ;
@@ -820,12 +820,6 @@ define([
820
820
}
821
821
} ) ;
822
822
823
- $image . on ( 'touchend' , function ( e ) {
824
- if ( isTouchEnabled && gallery . fullScreen ) {
825
- detectDoubleTap ( e ) ;
826
- }
827
- } ) ;
828
-
829
823
$ ( window ) . off ( 'resize' , resizeHandler ) ;
830
824
$ ( window ) . on ( 'resize' , {
831
825
$image : $image ,
0 commit comments