HN user

nirei

1 karma

Computer enchanter living in A Coruña, Galicia, on the spanish northwest.

Posts0
Comments2
View on HN
No posts found.

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?