Dotclear

Changeset 3904:c8bbba14c97a


Ignore:
Timestamp:
10/22/18 16:30:10 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Fix jQuery UI touch-punch plugin in order to give access to input/textarea fields on sortable elements.

See this PR:  https://github.com/furf/jquery-ui-touch-punch/pull/109

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/js/jquery/jquery.ui.touch-punch.js

    r3180 r3904  
    99 *  jquery.ui.mouse.js 
    1010 */ 
    11 (function ($) { 
     11(function($) { 
    1212 
    1313  // Detect touch support 
     
    2020 
    2121  var mouseProto = $.ui.mouse.prototype, 
    22       _mouseInit = mouseProto._mouseInit, 
    23       _mouseDestroy = mouseProto._mouseDestroy, 
    24       touchHandled; 
     22    _mouseInit = mouseProto._mouseInit, 
     23    _mouseDestroy = mouseProto._mouseDestroy, 
     24    touchHandled; 
    2525 
    2626  /** 
     
    2929   * @param {String} simulatedType The corresponding mouse event 
    3030   */ 
    31   function simulateMouseEvent (event, simulatedType) { 
     31  function simulateMouseEvent(event, simulatedType) { 
    3232 
    3333    // Ignore multi-touch events 
     
    3636    } 
    3737 
    38     event.preventDefault(); 
     38//    event.preventDefault(); 
    3939 
    4040    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 
    4350    // Initialize the simulated mouse event using the touch event's coordinates 
    4451    simulatedEvent.initMouseEvent( 
    45       simulatedType,    // type 
    46       true,             // bubbles                     
    47       true,             // cancelable                  
    48       window,           // view                        
    49       1,                // detail                      
    50       touch.screenX,    // screenX                     
    51       touch.screenY,    // screenY                     
    52       touch.clientX,    // clientX                     
    53       touch.clientY,    // clientY                     
    54       false,            // ctrlKey                     
    55       false,            // altKey                      
    56       false,            // shiftKey                    
    57       false,            // metaKey                     
    58       0,                // button                      
    59       null              // relatedTarget               
     52      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 
    6067    ); 
    6168 
     
    6875   * @param {Object} event The widget element's touchstart event 
    6976   */ 
    70   mouseProto._touchStart = function (event) { 
     77  mouseProto._touchStart = function(event) { 
    7178 
    7279    var self = this; 
     
    97104   * @param {Object} event The document's touchmove event 
    98105   */ 
    99   mouseProto._touchMove = function (event) { 
     106  mouseProto._touchMove = function(event) { 
    100107 
    101108    // Ignore event if not handled 
     
    115122   * @param {Object} event The document's touchend event 
    116123   */ 
    117   mouseProto._touchEnd = function (event) { 
     124  mouseProto._touchEnd = function(event) { 
    118125 
    119126    // Ignore event if not handled 
     
    145152   * original mouse event handling methods. 
    146153   */ 
    147   mouseProto._mouseInit = function () { 
    148      
     154  mouseProto._mouseInit = function() { 
     155 
    149156    var self = this; 
    150157 
     
    163170   * Remove the touch event handlers 
    164171   */ 
    165   mouseProto._mouseDestroy = function () { 
    166      
     172  mouseProto._mouseDestroy = function() { 
     173 
    167174    var self = this; 
    168175 
Note: See TracChangeset for help on using the changeset viewer.

Sites map