1 |
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isNearbyPoints=exports.isEqualPoints=exports.getTouchPoints=exports.getSwipeDirection=exports.getPointsNumber=exports.getPointsDistance=void 0;var getTouchPoints=exports.getTouchPoints=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,s=t.touches,o=t.changedTouches,n=s&&0<s.length,i=o&&0<o.length,i=!n&&i?o[e]:n?s[e]:t;return{x:i.pageX,y:i.pageY}},getPointsNumber=exports.getPointsNumber=function(t){return t.touches&&t.touches.length||t.changedTouches&&t.changedTouches.length},isEqualPoints=exports.isEqualPoints=function(t,e){return t.x===e.x&&t.y===e.y},isNearbyPoints=exports.isNearbyPoints=function(t,e){var s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:25;return Math.abs(t.x-e.x)<s&Math.abs(t.y-e.y)<s},getPointsDistance=exports.getPointsDistance=function(t,e){var s=Math.abs(t.x-e.x),t=Math.abs(t.y-e.y);return Math.sqrt(s*s+t*t)},getSwipeDirection=exports.getSwipeDirection=function(t,e,s,o){return Math.abs(t-e)>=Math.abs(s-o)?0<t-e?"Left":"Right":0<s-o?"Up":"Down"};
|