src/touch.js
function simulateMouseEvent(e) {
  e.preventDefault();
  const touch = e.changedTouches[0];
  const eventMap = {
    'touchstart': 'mousedown',
    'touchmove': 'mousemove',
    'touchend': 'mouseup'
  }

  touch.target.dispatchEvent(new MouseEvent(eventMap[e.type], {
    bubbles: true,
    cancelable: true,
    view: window,
    clientX: touch.clientX,
    clientY: touch.clientY,
    screenX: touch.screenX,
    screenY: touch.screenY,
  }));
}
function simulateMouseEvent(e) {
  e.preventDefault();
  const touch = e.changedTouches[0];
  const eventMap = {
    'touchstart': 'mousedown',
    'touchmove': 'mousemove',
    'touchend': 'mouseup'
  }

  touch.target.dispatchEvent(new MouseEvent(eventMap[e.type], {
    bubbles: true,
    cancelable: true,
    view: window,
    clientX: touch.clientX,
    clientY: touch.clientY,
    screenX: touch.screenX,
    screenY: touch.screenY,
  }));
}
function simulateMouseEvent ( e ) { e . preventDefault ( ) ; const touch = e . changedTouches [ 0 ] ; const eventMap = { 'touchstart' : 'mousedown' , 'touchmove' : 'mousemove' , 'touchend' : 'mouseup' } touch . target . dispatchEvent ( new MouseEvent ( eventMap [ e . type ] , { bubbles : true , cancelable : true , view : window , clientX : touch . clientX , clientY : touch . clientY , screenX : touch . screenX , screenY : touch . screenY , } ) ) ; }
Translates a touch event to a mouse event.
@param {Event} e
Translates a touch event to a mouse event .