Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createWheelEvent(canvas, delta, x, y) {
const bbox = canvas.getBoundingClientRect();
const e = new Event('wheel', {}, false, false);
e.clientX = bbox.left + x;
e.clientY = bbox.top + y;
e.wheelDelta = delta;
return e;
}