UNPKG

hammerjs

Version:

A javascript library for multi-touch gestures

36 lines (32 loc) 940 B
/** * Touch * Called as first, tells the user has touched the screen * @events touch */ Hammer.gestures.Touch = { name : 'touch', index : -Infinity, defaults: { // call preventDefault at touchstart, and makes the element blocking by // disabling the scrolling of the page, but it improves gestures like // transforming and dragging. // be careful with using this, it can be very annoying for users to be stuck // on the page prevent_default : false, // disable mouse events, so only touch (or pen!) input triggers events prevent_mouseevents: false }, handler : function touchGesture(ev, inst) { if(inst.options.prevent_mouseevents && ev.pointerType == POINTER_MOUSE) { ev.stopDetect(); return; } if(inst.options.prevent_default) { ev.preventDefault(); } if(ev.eventType == EVENT_START) { inst.trigger(this.name, ev); } } };