let ele = document.getElementById('GameCanvas');
let rect = ele.getBoundingClientRect();
let touch = new Touch({
"identifier" : 0,
"target" : ele,
"clientX" : (rect.left + rect.right)/2,
"clientY" : (rect.top + rect.bottom)/2,
"screenX" : (rect.left + rect.right)/2,
"screenY" : (rect.top + rect.bottom)/2,
"pageX" : (rect.left + rect.right)/2,
"pageY" : (rect.top + rect.bottom)/2,
"radiusX" : 11.5,
"radiusY" : 11.5,
"rotationAngle" : 0.0,
"force" : 1});
let touchstart = new TouchEvent("touchstart", {
cancelable: true,
bubbles: true,
composed: true,
touches: [touch],
targetTouches: [touch],
changedTouches: [touch]
});
let touchend = new TouchEvent("touchend", {
cancelable: true,
bubbles: true,
composed: true,
touches: [touch],
targetTouches: [touch],
changedTouches: [touch]
});
ele.dispatchEvent(touchstart);
ele.dispatchEvent(touchend);