Changeset 3904:c8bbba14c97a
- Timestamp:
- 10/22/18 16:30:10 (7 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/jquery/jquery.ui.touch-punch.js
r3180 r3904 9 9 * jquery.ui.mouse.js 10 10 */ 11 (function 11 (function($) { 12 12 13 13 // Detect touch support … … 20 20 21 21 var mouseProto = $.ui.mouse.prototype, 22 23 24 22 _mouseInit = mouseProto._mouseInit, 23 _mouseDestroy = mouseProto._mouseDestroy, 24 touchHandled; 25 25 26 26 /** … … 29 29 * @param {String} simulatedType The corresponding mouse event 30 30 */ 31 function simulateMouseEvent 31 function simulateMouseEvent(event, simulatedType) { 32 32 33 33 // Ignore multi-touch events … … 36 36 } 37 37 38 event.preventDefault();38 // event.preventDefault(); 39 39 40 40 var touch = event.originalEvent.changedTouches[0], 41 simulatedEvent = document.createEvent('MouseEvents'); 42 41 simulatedEvent = document.createEvent('MouseEvents'); 42 43 // Check if element is an input or a textarea 44 if ($(touch.target).is("input") || $(touch.target).is("textarea")) { 45 event.stopPropagation(); 46 } else { 47 event.preventDefault(); 48 } 49 43 50 // Initialize the simulated mouse event using the touch event's coordinates 44 51 simulatedEvent.initMouseEvent( 45 simulatedType, 46 true, // bubbles47 true, // cancelable48 window, // view49 1, // detail50 touch.screenX, // screenX51 touch.screenY, // screenY52 touch.clientX, // clientX53 touch.clientY, // clientY54 false, // ctrlKey55 false, // altKey56 false, // shiftKey57 false, // metaKey58 0, // button59 null // relatedTarget52 simulatedType, // type 53 true, // bubbles 54 true, // cancelable 55 window, // view 56 1, // detail 57 touch.screenX, // screenX 58 touch.screenY, // screenY 59 touch.clientX, // clientX 60 touch.clientY, // clientY 61 false, // ctrlKey 62 false, // altKey 63 false, // shiftKey 64 false, // metaKey 65 0, // button 66 null // relatedTarget 60 67 ); 61 68 … … 68 75 * @param {Object} event The widget element's touchstart event 69 76 */ 70 mouseProto._touchStart = function 77 mouseProto._touchStart = function(event) { 71 78 72 79 var self = this; … … 97 104 * @param {Object} event The document's touchmove event 98 105 */ 99 mouseProto._touchMove = function 106 mouseProto._touchMove = function(event) { 100 107 101 108 // Ignore event if not handled … … 115 122 * @param {Object} event The document's touchend event 116 123 */ 117 mouseProto._touchEnd = function 124 mouseProto._touchEnd = function(event) { 118 125 119 126 // Ignore event if not handled … … 145 152 * original mouse event handling methods. 146 153 */ 147 mouseProto._mouseInit = function 148 154 mouseProto._mouseInit = function() { 155 149 156 var self = this; 150 157 … … 163 170 * Remove the touch event handlers 164 171 */ 165 mouseProto._mouseDestroy = function 166 172 mouseProto._mouseDestroy = function() { 173 167 174 var self = this; 168 175
Note: See TracChangeset
for help on using the changeset viewer.