12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- /**
- * mui gesture longtap
- * @param {type} $
- * @param {type} name
- * @returns {undefined}
- */
- (function($, name) {
- var timer;
- var handle = function(event, touch) {
- var session = $.gestures.session;
- var options = this.options;
- switch (event.type) {
- case $.EVENT_START:
- clearTimeout(timer);
- timer = setTimeout(function() {
- $.trigger(session.target, name, touch);
- }, options.holdTimeout);
- break;
- case $.EVENT_MOVE:
- if (touch.distance > options.holdThreshold) {
- clearTimeout(timer);
- }
- break;
- case $.EVENT_END:
- case $.EVENT_CANCEL:
- clearTimeout(timer);
- break;
- }
- };
- /**
- * mui gesture longtap
- */
- $.addGesture({
- name: name,
- index: 10,
- handle: handle,
- options: {
- fingers: 1,
- holdTimeout: 500,
- holdThreshold: 2
- }
- });
- })(mui, 'longtap');
|