Skip to content

Latest commit

 

History

History
50 lines (29 loc) · 2.28 KB

question.md

File metadata and controls

50 lines (29 loc) · 2.28 KB

common problem

The name field of the gesture recognizer is required

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);

🚀 back to directory

Don't debug with alert

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

🚀 back to directory

The chrome browser on macOS will be slower to trigger touchend

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.

🚀 back to directory

Try to use the tap proxy on the mobile terminal click

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 });

🚀 back to directory

Can't slide the page after using AnyTouch?

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

🚀 back to directory