3 lines
634 B
JavaScript
3 lines
634 B
JavaScript
import{createPluginContext as t,TYPE_END as e}from"@any-touch/shared";import{ComputeDistance as o,ComputeVAndDir as n,ComputeMaxLength as i}from"@any-touch/compute";const c={name:"swipe",threshold:10,velocity:.3,pointLength:1};function a(a,r){const s=t(c,r);return a.compute([o,n,i],(t=>{if(s.state=0,!s.disabled&&function(){if(e!==t.phase)return!1;const{velocityX:o,velocityY:n,distance:i,maxPointLength:c}=t;return c===s.pointLength&&0===t.points.length&&s.threshold<i&&s.velocity<Math.max(o,n)}()){const{name:e}=s;s.state=1,a.emit2(e,t,s),a.emit2(e+t.direction,t,s)}})),s}export{a as default};
|
|
//# sourceMappingURL=index.es.js.map
|