inherit(TouchInput, Input, {
1014 handler: function MTEhandler(ev) { 1015 var type = TOUCH_INPUT_MAP[ev.type]; 1016 var touches = getTouches.call(this, ev, type); 1021 this.callback(this.manager, type, { 1022 pointers: touches[0], 1023 changedPointers: touches[1], 1024 pointerType: INPUT_TYPE_TOUCH, 1031 * @this {TouchInput} 1032 * @param {Object} ev 1033 * @param {Number} type flag 1034 * @returns {undefined|Array} [all, changed] 1036 function getTouches(ev, type) { 1037 var allTouches = toArray(ev.touches); 1038 var targetIds = this.targetIds; 1040 // when there is only one touch, the process can be simplified 1041 if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) { 1042 targetIds[allTouches[0].identifier] = true; 1043 return [allTouches, allTouches]; 1048 changedTouches = toArray(ev.changedTouches), 1049 changedTargetTouches = [], 1050 target = this.target; 1052 // get target touches from touches 1053 targetTouches = allTouches.filter(function(touch) { 1054 return hasParent(touch.target, target); 1058 if (type === INPUT_START) { 1060 while (i < targetTouches.length) { 1061 targetIds[targetTouches[i].identifier] = true; 1066 // filter changed touches to only contain touches that exist in the collected target ids 1068 while (i < changedTouches.length) { 1069 if (targetIds[changedTouches[i].identifier]) { 1070 changedTargetTouches.push(changedTouches[i]); 1073 // cleanup removed touches 1074 if (type & (INPUT_END | INPUT_CANCEL)) { 1075 delete targetIds[changedTouches[i].identifier]; 1080 if (!changedTargetTouches.length) { 1085 // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel' 1086 uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), 1087 changedTargetTouches 1092 * Combined touch and mouse input 1094 * Touch has a higher priority then mouse, and while touching no mouse events are allowed. 1095 * This because touch devices also emit mouse events while doing a touch.