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CAAC;YACrC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACrC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9E,CAAC;KACF;CACF,CAAC,CAAC","file":"touch.js","sourcesContent":["const MinDistance = 10;\nconst getDirection = (x: number, y: number) => {\n if (x > y && x > MinDistance) {\n return 'horizontal';\n }\n if (y > x && y > MinDistance) {\n return 'vertical';\n }\n return '';\n};\n\nexport default Behavior({\n methods: {\n resetTouchStatus() {\n this.direction = '';\n this.deltaX = 0;\n this.deltaY = 0;\n this.offsetX = 0;\n this.offsetY = 0;\n },\n touchStart(event: any) {\n this.resetTouchStatus();\n const [touch] = event.touches;\n this.startX = touch.clientX;\n this.startY = touch.clientY;\n },\n touchMove(event: any) {\n const [touch] = event.touches;\n this.deltaX = touch.clientX - this.startX;\n this.deltaY = touch.clientY - this.startY;\n this.offsetX = Math.abs(this.deltaX);\n this.offsetY = Math.abs(this.deltaY);\n this.direction = this.direction || getDirection(this.offsetX, this.offsetY);\n },\n },\n});\n"]}