/** * mui gesture tap and doubleTap * @param {type} $ * @param {type} name * @returns {undefined} */ (function($, name) { var lastTarget; var lastTapTime; var handle = function(event, touch) { var session = $.gestures.session; var options = this.options; switch (event.type) { case $.EVENT_END: if (!touch.isFinal) { return; } var target = session.target; if (!target || (target.disabled || (target.classList && target.classList.contains($.className('disabled'))))) { return; } if (touch.distance < options.tapMaxDistance && touch.deltaTime < options.tapMaxTime) { if ($.options.gestureConfig.doubletap && lastTarget && (lastTarget === target)) { //same target if (lastTapTime && (touch.timestamp - lastTapTime) < options.tapMaxInterval) { $.trigger(target, 'doubletap', touch); lastTapTime = $.now(); lastTarget = target; return; } } $.trigger(target, name, touch); lastTapTime = $.now(); lastTarget = target; } break; } }; /** * mui gesture tap */ $.addGesture({ name: name, index: 30, handle: handle, options: { fingers: 1, tapMaxInterval: 300, tapMaxDistance: 5, tapMaxTime: 250 } }); })(mui, 'tap');