You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
885 B
45 lines
885 B
/**
|
|
* mui gesture hold
|
|
* @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:
|
|
if ($.options.gestureConfig.hold) {
|
|
timer && clearTimeout(timer);
|
|
timer = setTimeout(function() {
|
|
touch.hold = true;
|
|
$.trigger(session.target, name, touch);
|
|
}, options.holdTimeout);
|
|
}
|
|
break;
|
|
case $.EVENT_MOVE:
|
|
break;
|
|
case $.EVENT_END:
|
|
case $.EVENT_CANCEL:
|
|
if (timer) {
|
|
clearTimeout(timer) && (timer = null);
|
|
$.trigger(session.target, 'release', touch);
|
|
}
|
|
break;
|
|
}
|
|
};
|
|
/**
|
|
* mui gesture hold
|
|
*/
|
|
$.addGesture({
|
|
name: name,
|
|
index: 10,
|
|
handle: handle,
|
|
options: {
|
|
fingers: 1,
|
|
holdTimeout: 0
|
|
}
|
|
});
|
|
})(mui, 'hold'); |