@@ -610,6 +610,7 @@ define([
610
610
}
611
611
612
612
function pointerMoveHandler ( ev ) {
613
+ let timeout ;
613
614
for ( let i = 0 ; i < evCache . length ; i ++ ) {
614
615
if ( ev . pointerId === evCache [ i ] . pointerId ) {
615
616
evCache [ i ] = ev ;
@@ -627,14 +628,16 @@ define([
627
628
if ( curDiff - prevDiff > 0.2 && allowZoomIn ) {
628
629
preventAction = true ;
629
630
zoomIn ( ev , curDiff , curDiff ) ;
630
- setTimeout ( ( ) => {
631
+ timeout = setTimeout ( ( ) => {
632
+ clearTimeout ( timeout ) ;
631
633
preventAction = false ;
632
634
} , 500 ) ;
633
635
}
634
636
if ( curDiff - prevDiff < - 0.2 && allowZoomOut ) {
635
637
preventAction = true ;
636
638
zoomOut ( ev , curDiff , curDiff ) ;
637
- setTimeout ( ( ) => {
639
+ timeout = setTimeout ( ( ) => {
640
+ clearTimeout ( timeout ) ;
638
641
preventAction = false ;
639
642
} , 500 ) ;
640
643
}
@@ -692,13 +695,14 @@ define([
692
695
const curTime = new Date ( ) . getTime ( ) ;
693
696
const tapLen = curTime - lastTap ;
694
697
698
+ transitionActive = false ;
695
699
if ( tapLen < 300 && tapLen > 50 && ! preventAction ) {
696
700
event . preventDefault ( ) ;
697
701
698
- transitionActive = false ;
699
702
preventAction = true ;
700
703
dblClickHandler ( event ) ;
701
- setTimeout ( ( ) => {
704
+ timeout = setTimeout ( ( ) => {
705
+ clearTimeout ( timeout ) ;
702
706
preventAction = false ;
703
707
} , 500 ) ;
704
708
prevDiff = - 1 ;
@@ -733,6 +737,9 @@ define([
733
737
734
738
$image . off ( 'touchend' ) ;
735
739
$image . on ( 'touchend' , detectDoubleTap ( ) ) ;
740
+
741
+ $image . off ( 'touchcancel' ) ;
742
+ $image . on ( 'touchcancel' , ( ) => { transitionActive = false } ) ;
736
743
} else {
737
744
$image . off ( 'dblclick' ) ;
738
745
$image . on ( 'dblclick' , dblClickHandler ) ;
0 commit comments