Skip to content

Instantly share code, notes, and snippets.

@rowan-m
Created August 27, 2019 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rowan-m/10f4b14e90437be6c7ab70b8f94e9bee to your computer and use it in GitHub Desktop.
Save rowan-m/10f4b14e90437be6c7ab70b8f94e9bee to your computer and use it in GitHub Desktop.
_onTouchstart(e) {
e.preventDefault();
this._touchX = e.changedTouches[0].clientX;
this._touchY = e.changedTouches[0].clientY;
this._rotationStart();
this.addEventListener('touchmove', this._onTouchmove);
this.addEventListener('touchend', this._onTouchend);
this.addEventListener('touchcancel', this._onTouchend);
}
_onTouchmove(e) {
e.preventDefault();
this._touchX = e.targetTouches[0].clientX;
this._touchY = e.targetTouches[0].clientY;
this._rotationChange();
}
_onTouchend(e) {
e.preventDefault();
this.removeEventListener('touchmove', this._onTouchmove);
this.removeEventListener('touchend', this._onTouchend);
this.removeEventListener('touchcancel', this._onTouchend);
this._rotationEnd();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment