Created
April 17, 2020 12:05
-
-
Save Gazzell/62458f1dd791738ade0c5634ab0bdf37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function firePointerEvent(el, eventName, x,y){ | |
const ev = new MouseEvent(eventName, { | |
clientX: x, clientY: y, bubbles: true, cancelable: true | |
}); | |
el.dispatchEvent(ev); | |
} | |
var relativePosition = APP.getNodePositionAsOffset("cards.ticket1.emptyTicket.buttonAdd") | |
var canvas = document.getElementsByTagName("canvas")[0]; | |
var rect = canvas.getBoundingClientRect(); | |
firePointerEvent(canvas, "pointerdown", rect.x + relativePosition.x, rect.y + relativePosition.y); | |
firePointerEvent(canvas, "pointerup", rect.x + relativePosition.x, rect.y + relativePosition.y); | |
relativePosition = APP.getNodePositionAsOffset("cards.ticket2.emptyTicket.buttonAdd") | |
firePointerEvent(canvas, "click", rect.x + relativePosition.x, rect.y + relativePosition.y); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment