Search code examples
xtermjs

How to select with touch event (iPad) on xtermjs


xtermjs top page has demo section. I can select with mouse click so that I can copy the selection. However, on iPad, I can't select with touch. Is there any way to select on xtermjs for the touch devices, like iPad?

I added touchstart event and could get pageY but I'm not sure how to convert coordinates to cols and rows.. As long as cols and rows there, I think we can use xterm api to select but I can't find a way..

document.addEventListener('touchstart', function(event){ 
  alert(event.touches[0].pageY)
})

Solution

  • I found solution by myself.. I mapped touch events to mouse events and works well.

    JavaScript mapping touch events to mouse events