@@ -610,6 +610,7 @@ define([
610610 }
611611
612612 function pointerMoveHandler ( ev ) {
613+ let timeout ;
613614 for ( let i = 0 ; i < evCache . length ; i ++ ) {
614615 if ( ev . pointerId === evCache [ i ] . pointerId ) {
615616 evCache [ i ] = ev ;
@@ -627,14 +628,16 @@ define([
627628 if ( curDiff - prevDiff > 0.2 && allowZoomIn ) {
628629 preventAction = true ;
629630 zoomIn ( ev , curDiff , curDiff ) ;
630- setTimeout ( ( ) => {
631+ timeout = setTimeout ( ( ) => {
632+ clearTimeout ( timeout ) ;
631633 preventAction = false ;
632634 } , 500 ) ;
633635 }
634636 if ( curDiff - prevDiff < - 0.2 && allowZoomOut ) {
635637 preventAction = true ;
636638 zoomOut ( ev , curDiff , curDiff ) ;
637- setTimeout ( ( ) => {
639+ timeout = setTimeout ( ( ) => {
640+ clearTimeout ( timeout ) ;
638641 preventAction = false ;
639642 } , 500 ) ;
640643 }
@@ -692,13 +695,14 @@ define([
692695 const curTime = new Date ( ) . getTime ( ) ;
693696 const tapLen = curTime - lastTap ;
694697
698+ transitionActive = false ;
695699 if ( tapLen < 300 && tapLen > 50 && ! preventAction ) {
696700 event . preventDefault ( ) ;
697701
698- transitionActive = false ;
699702 preventAction = true ;
700703 dblClickHandler ( event ) ;
701- setTimeout ( ( ) => {
704+ timeout = setTimeout ( ( ) => {
705+ clearTimeout ( timeout ) ;
702706 preventAction = false ;
703707 } , 500 ) ;
704708 prevDiff = - 1 ;
@@ -733,6 +737,9 @@ define([
733737
734738 $image . off ( 'touchend' ) ;
735739 $image . on ( 'touchend' , detectDoubleTap ( ) ) ;
740+
741+ $image . off ( 'touchcancel' ) ;
742+ $image . on ( 'touchcancel' , ( ) => { transitionActive = false } ) ;
736743 } else {
737744 $image . off ( 'dblclick' ) ;
738745 $image . on ( 'dblclick' , dblClickHandler ) ;
0 commit comments