touch.js 920 B

12345678910111213141516171819202122232425262728293031323334353637
  1. export default class Touch {
  2. // #DISTANCE = 50;
  3. //
  4. // startX = 0;
  5. //
  6. // startY = 0;
  7. //
  8. // setStartPoint(point) {
  9. // const { clientX, clientY } = point;
  10. // this.startX = clientX;
  11. // this.startY = clientY;
  12. // }
  13. //
  14. // getMoveDistance(clientX, clientY) {
  15. // return {
  16. // deltaX: clientX - this.startX,
  17. // deltaY: clientY - this.startY,
  18. // };
  19. // }
  20. //
  21. // getDirection(point) {
  22. // const { clientX, clientY } = point;
  23. // const { deltaX, deltaY } = this.getMoveDistance(clientX, clientY);
  24. // let directionH = '';
  25. // let directionV = '';
  26. // if (Math.abs(deltaX) > this.#DISTANCE) {
  27. // directionH = clientX > this.startX ? 'right' : 'left';
  28. // }
  29. // if (Math.abs(deltaY) > this.#DISTANCE) {
  30. // directionV = clientY > this.startY ? 'top' : 'bottom';
  31. // }
  32. // return {
  33. // directionH,
  34. // directionV,
  35. // };
  36. // }
  37. }