- do not debug with alert
- The chrome browser on macos will trigger touchend slower
- Use the tap proxy click on the mobile terminal as much as possible
The custom gesture must remember to give a name, and do not have the same name as the default gesture (already tap/swipe/pan/rotate/pinch/press).
at.use(tap, { pointLength: 2, name: 'twoFingersTap' });
at.on('twoFingersTap', onTwoFingersTap);
On a real Android phone, if alert
is triggered during the touchstart
or touchmove
stage, there will be a subsequent bug that touchmove/touchend
does not trigger. So please avoid using alert
in the gesture event callback `.
Test code
If you are only debugging on the mobile terminal, please use Tencent's vconsole
Due to the above reasons, the swipe event will be "half a beat", so please make the final test based on the mobile phone effect.
On the mobile side, touchstart is triggered before click, so preventDefault in the touchstart phase will prevent click from triggering. It is precisely that any-touch uses preventDefault
in touchstart by default to prevent the triggering of browser default events, such as click and page scrolling.
If the mobile terminal must use click to do the following settings
const at = new AnyTouch(el, { preventDefault: false });
Because AnyTouch has "preventDefault:true" enabled by default, you can set it to "false", but if the interaction situation is more complicated and cannot be satisfied, you can refer to Prevent Default Events