3 ms·
function createEvent(type, x, y) { const event = new PointerEvent(type, {pointerId: 1, bubbles: true, cancelable: true, pointerType: "touch"
by nirei 6y ago
function createEvent(type, x, y) {
const event = new PointerEvent(type,
{pointerId: 1,
bubbles: true,
cancelable: true,
pointerType: "touch",
width: 100,
height: 100,
isPrimary: true,
clientX: x,
clientY: y
});
const element = document.getElementById('canvas');
element.dispatchEvent(event);
}
createEvent("pointerdown", 0, 300);
for(x = 0; x < 100; x+=10) {
createEvent("pointermove", x, 300)
}
createEvent("pointerup", 100, 300);
what am I doing wrong?