event-flick-debug.js revision df44ce679e6e095a4e0f1a587961e4d0962b37a9
80ea28fae9dc032e5b99c726c41e492cd59bf49dJeff Conniff * Adds support for a "flick" event, which is fired at the end of a touch or mouse based flick gesture, and provides
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * velocity of the flick, along with distance and time information.
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * @module event-gestures
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * @submodule event-flick
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich// TODO: Better way to sniff 'n' switch touch support?
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovichvar EVENT = ("ontouchstart" in Y.config.win) ? {
80ea28fae9dc032e5b99c726c41e492cd59bf49dJeff Conniff * Sets up a "flick" event, that is fired whenever the user initiates a flick gesture on the node
80ea28fae9dc032e5b99c726c41e492cd59bf49dJeff Conniff * where the listener is attached. The subscriber can specify a minimum distance or velocity for
3600c6bf768f1465933aaf2e3820d9d9f6b97890Allen Rabinovich * which the event is to be fired.
80ea28fae9dc032e5b99c726c41e492cd59bf49dJeff Conniff * @event flick
80ea28fae9dc032e5b99c726c41e492cd59bf49dJeff Conniff * @param type {string} "flick"
80ea28fae9dc032e5b99c726c41e492cd59bf49dJeff Conniff * @param fn {function} The method the event invokes.
80ea28fae9dc032e5b99c726c41e492cd59bf49dJeff Conniff * @param cfg {Object} Optional. An object which specifies the minimum distance and/or velocity
80ea28fae9dc032e5b99c726c41e492cd59bf49dJeff Conniff * of the flick gesture for which the event is to be fired.
80ea28fae9dc032e5b99c726c41e492cd59bf49dJeff Conniff * @return {EventHandle} the detach handle
80ea28fae9dc032e5b99c726c41e492cd59bf49dJeff Conniff node.setData(_FLICK_START_HANDLE, startHandle);
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich var startHandle = node.getData(_FLICK_START_HANDLE),
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich endHandle = node.getData(_FLICK_END_HANDLE);
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich var params = (args[3]) ? args.splice(3, 1)[0] : {};
Y.log("flick, processArgs : minDistance =" + params.minDistance + ", minVelocity =" + params.minVelocity);
return params;
sub,
for (i in subs) {
subs[i] = null;
doc,
origE = e;
if (e.touches) {
if (start) {
_e : e
if (!endHandle) {
endEvent = e,
time,
axis;
if (valid) {
if (e.changedTouches) {
valid = false;
if (valid) {
xyDistance = [
end: {
_e : e