MCPcopy Create free account
hub / github.com/ampproject/amphtml / onTouchMove

Method onTouchMove

src/gesture-recognizers.js:756–789  ·  view source on GitHub ↗

@override

(e)

Source from the content-addressed store, hash-verified

754
755 /** @override */
756 onTouchMove(e) {
757 const {touches} = e;
758 if (!touches || touches.length == 0) {
759 return false;
760 }
761 // Pinch touches are not always simultaneous, continue to listen
762 // for second touch.
763 if (touches.length == 1) {
764 return true;
765 }
766
767 // Have 2+ touches
768 this.lastX1_ = touches[0].clientX;
769 this.lastY1_ = touches[0].clientY;
770 this.lastX2_ = touches[1].clientX;
771 this.lastY2_ = touches[1].clientY;
772
773 // If eventing, always emit gesture with new coordinates
774 if (this.eventing_) {
775 this.emit_(false, false, e);
776 return true;
777 }
778
779 // Gesture is 2+ touch but direction indicates not a pinch
780 if (this.isPinchRejected_()) {
781 return false;
782 }
783
784 if (this.isPinchReady_()) {
785 this.signalReady(0);
786 }
787 // Pinch gesture detected but threshold not reached, continue listening
788 return true;
789 }
790
791 /**
792 * @return {boolean}

Callers

nothing calls this directly

Calls 4

emit_Method · 0.95
isPinchRejected_Method · 0.95
isPinchReady_Method · 0.95
signalReadyMethod · 0.80

Tested by

no test coverage detected