1

I have a scenario in which I get a List of Points that need to be converted to a TouchEvent which needs to be applied to the DOM to fire the appropriate listeners. The receiving end works with touchEvent.targetTouches[].

I have found these answers on Stackoverflow for JavaScript:

manually trigger touch event

How do I programmatically create a TouchEvent in Chrome 41?

var e = document.createEvent('TouchEvent');
e.touches = [{pageX: pageX, pageY: pageY}];

In Dart this would roughly translate to:

TouchEvent e = new Event.eventType("TouchEvent", "touchstart");

e.touches is read only, so how do I set the coordinates?

Community
  • 1
  • 1
Manuel
  • 157
  • 1
  • 10
  • Sounds like the similar story to the "create keyboard events". You could try `new CustomEvent('touch')` and pass data using the `detail` parameter. https://api.dartlang.org/stable/1.18.1/dart-html/CustomEvent-class.html No idea how much control you have over the event receiver to work with such events. – Günter Zöchbauer Aug 19 '16 at 13:27

0 Answers0