Check whether Touch and TouchEvent constructors are supported
Touch.length =
TouchEvent.length =
Creating a Touch object using constructor
t = new Touch({
identifier: 42,
target: document.body,
clientX: 200,
clientY: 200,
screenX: 300,
screenY: 300,
pageX: 250,
pageY: 250,
radiusX: 2.5,
radiusY: 2.5,
rotationAngle: 10,
force: 0.5,
});
Result:
Creating a TouchEvent object using constructor
te = new TouchEvent("touchstart", {
cancelable: true,
bubbles: true,
touches: [t],
targetTouches: [],
changedTouches: [t],
shiftKey: true,
});
Result: