Skip to content

Instantly share code, notes, and snippets.

@paramjeetdhiman
Created February 5, 2021 11:04
Show Gist options
  • Save paramjeetdhiman/f07dbd48632e4ea624fd5dda84b95286 to your computer and use it in GitHub Desktop.
Save paramjeetdhiman/f07dbd48632e4ea624fd5dda84b95286 to your computer and use it in GitHub Desktop.
let boom = {
a: {x: 1200, y:230},
b: {x: 150, y: 250}
};
(function (data) {
var canvas = document.getElementById("toplevelGraphCanvas");
var rect = canvas.getBoundingClientRect();
var type = "mousedown";
canvas.dispatchEvent(
new MouseEvent(type, {
clientX: rect.left + data.a.x,
clientY: rect.top + data.a.y,
})
);
type="mousemove";
canvas.dispatchEvent(
new MouseEvent(type, {
clientX: rect.left + data.b.x,
clientY: rect.top + data.b.y,
})
);
type = "mouseup";
canvas.dispatchEvent(
new MouseEvent(type, {
clientX: rect.left + data.b.x,
clientY: rect.top + data.b.y,
})
);
})(boom);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment