copies the MouseEvent (or convert Touch) properties and sends it as another event to the given target
(e: MouseEvent | Touch, simulatedType: string, target?: EventTarget)
| 698 | |
| 699 | /** copies the MouseEvent (or convert Touch) properties and sends it as another event to the given target */ |
| 700 | public static simulateMouseEvent(e: MouseEvent | Touch, simulatedType: string, target?: EventTarget): void { |
| 701 | const me = e as MouseEvent; |
| 702 | const simulatedEvent = new MouseEvent(simulatedType, { |
| 703 | bubbles: true, |
| 704 | composed: true, |
| 705 | cancelable: true, |
| 706 | view: window, |
| 707 | detail: 1, |
| 708 | screenX: e.screenX, |
| 709 | screenY: e.screenY, |
| 710 | clientX: e.clientX, |
| 711 | clientY: e.clientY, |
| 712 | ctrlKey: me.ctrlKey??false, |
| 713 | altKey: me.altKey??false, |
| 714 | shiftKey: me.shiftKey??false, |
| 715 | metaKey: me.metaKey??false, |
| 716 | button: 0, |
| 717 | relatedTarget: e.target |
| 718 | }); |
| 719 | |
| 720 | (target || e.target).dispatchEvent(simulatedEvent); |
| 721 | } |
| 722 | |
| 723 | /** |
| 724 | * defines an element that is used to get the offset and scale from grid transforms |
no outgoing calls
no test coverage detected