event-flick-debug.js revision 35a16952b0308d5bf01f468c2e748bd2895a4bdf
/**
* Adds support for a "flick" event, which is fired at the end of a touch or mouse based flick gesture, and provides
* velocity of the flick, along with distance and time information.
*
* @module event-gestures
* @submodule event-flick
*/
// TODO: Better way to sniff 'n' switch touch support?
start: "touchstart",
end: "touchend"
} : {
start: "mousedown",
end: "mouseup"
},
START = "start",
END = "end",
OWNER_DOCUMENT = "ownerDocument",
MIN_VELOCITY = "minVelocity",
MIN_DISTANCE = "minDistance",
_FLICK_START = "_fs",
_FLICK_START_HANDLE = "_fsh",
_FLICK_END_HANDLE = "_feh",
NODE_TYPE = "nodeType";
/**
* Sets up a "flick" event, that is fired whenever the user initiates a flick gesture on the node
* where the listener is attached. The subscriber can specify a minimum distance or velocity for
* which the event is to be fired.
*
* @event flick
* @param type {string} "flick"
* @param fn {function} The method the event invokes.
* of the flick gesture for which the event is to be fired.
*
* @return {EventHandle} the detach handle
*/
// The initialization implementation. Called for the first subscription per node.
this._onStart,
this,
node,
ce);
},
// The destroy implementation. Called for the last detach per node.
if (startHandle) {
}
if (endHandle) {
}
},
// How to process the additional spec args
processArgs: function(args) {
if (!(MIN_VELOCITY in params)) {
}
if (!(MIN_DISTANCE in params)) {
}
Y.log("flick, processArgs : minDistance =" + params.minDistance + ", minVelocity =" + params.minVelocity);
return params;
},
// Internal DOM listener to identify the start of the gesture
var start = true, // always true for mouse
doc;
if (e.touches) {
e = e.touches[0];
}
if (start) {
e.preventDefault();
_e : e
});
if (!endHandle) {
}
}
},
// Internal DOM listener to identify the end of the gesture. Fires the
// synthetic flick event.
endEvent = e,
time,
axis;
if (valid) {
if (e.changedTouches) {
} else {
valid = false;
}
}
if (valid) {
xyDistance = [
];
end: {
_e : e
}
});
}
}
}
},
MIN_VELOCITY : 0,
MIN_DISTANCE : 10
});