MCPcopy Index your code
hub / github.com/gridstack/gridstack.js / simulateMouseEvent

Method simulateMouseEvent

src/utils.ts:700–721  ·  view source on GitHub ↗

copies the MouseEvent (or convert Touch) properties and sends it as another event to the given target

(e: MouseEvent | Touch, simulatedType: string, target?: EventTarget)

Source from the content-addressed store, hash-verified

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

Callers 4

makeSubGridMethod · 0.80
removeAsSubGridMethod · 0.80
simulateMouseEventFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected