76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Adds touch event facade normalization properties (touches, changedTouches, targetTouches etc.) to the DOM event facade
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @module event-touch
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Adds touch event facade normalization properties to the DOM event facade
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @method _touch
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @for DOMEventFacade
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param ev {Event} the DOM event
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param currentTarget {HTMLElement} the element the listener was attached to
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param wrapper {Event.Custom} the custom event wrapper for this DOM event
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav GlassY.DOMEventFacade.prototype._touch = function(e, currentTarget, wrapper) {
dcde9f9fdb7cdb40d391c49e82df809afef42c01Luke Smith * Array of individual touch events for touch points that are still in
dcde9f9fdb7cdb40d391c49e82df809afef42c01Luke Smith * contact with the touch surface.
dcde9f9fdb7cdb40d391c49e82df809afef42c01Luke Smith * @property touches
dcde9f9fdb7cdb40d391c49e82df809afef42c01Luke Smith * @type {DOMEventFacade[]}
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass touchCache[Y.stamp(et)] = this.touches[i] = new Y.DOMEventFacade(et, currentTarget, wrapper);
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass Y.log("Found e.targetTouches. Replicating on facade");
dcde9f9fdb7cdb40d391c49e82df809afef42c01Luke Smith * Array of individual touch events still in contact with the touch
dcde9f9fdb7cdb40d391c49e82df809afef42c01Luke Smith * surface and whose `touchstart` event occurred inside the same taregt
dcde9f9fdb7cdb40d391c49e82df809afef42c01Luke Smith * element as the current target element.
dcde9f9fdb7cdb40d391c49e82df809afef42c01Luke Smith * @property targetTouches
dcde9f9fdb7cdb40d391c49e82df809afef42c01Luke Smith * @type {DOMEventFacade[]}
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass for (i = 0, l = e.targetTouches.length; i < l; ++i) {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass etCached = touchCache && touchCache[Y.stamp(et, true)];
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass this.targetTouches[i] = etCached || new Y.DOMEventFacade(et, currentTarget, wrapper);
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass if (etCached) { Y.log("Found native event in touches. Using same facade in targetTouches"); }
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass Y.log("Found e.changedTouches. Replicating on facade");
dcde9f9fdb7cdb40d391c49e82df809afef42c01Luke Smith An array of event-specific touch events.
dcde9f9fdb7cdb40d391c49e82df809afef42c01Luke Smith For `touchstart`, the touch points that became active with the current
dcde9f9fdb7cdb40d391c49e82df809afef42c01Luke Smith For `touchmove`, the touch points that have changed since the last
dcde9f9fdb7cdb40d391c49e82df809afef42c01Luke Smith For `touchend`, the touch points that have been removed from the touch
dcde9f9fdb7cdb40d391c49e82df809afef42c01Luke Smith @property changedTouches
dcde9f9fdb7cdb40d391c49e82df809afef42c01Luke Smith @type {DOMEventFacade[]}
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass for (i = 0, l = e.changedTouches.length; i < l; ++i) {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass etCached = touchCache && touchCache[Y.stamp(et, true)];
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass this.changedTouches[i] = etCached || new Y.DOMEventFacade(et, currentTarget, wrapper);
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass if (etCached) { Y.log("Found native event in touches. Using same facade in changedTouches"); }