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

Method initEvent

src/utils.ts:684–697  ·  view source on GitHub ↗
(e: DragEvent | MouseEvent, info: { type: string; target?: EventTarget })

Source from the content-addressed store, hash-verified

682 }
683
684 public static initEvent<T>(e: DragEvent | MouseEvent, info: { type: string; target?: EventTarget }): T {
685 const evt = { type: info.type };
686 const obj = {
687 button: 0,
688 which: 0,
689 buttons: 1,
690 bubbles: true,
691 cancelable: true,
692 target: info.target ? info.target : e.target
693 };
694 ['altKey','ctrlKey','metaKey','shiftKey'].forEach(p => evt[p] = e[p]); // keys
695 ['pageX','pageY','clientX','clientY','screenX','screenY'].forEach(p => evt[p] = e[p]); // point info
696 return {...evt, ...obj} as unknown as T;
697 }
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 {

Callers 10

_callDragMethod · 0.80
_mouseMoveMethod · 0.80
_mouseUpMethod · 0.80
_resizeStartMethod · 0.80
_resizingMethod · 0.80
_resizeStopMethod · 0.80
_mouseEnterMethod · 0.80
_mouseLeaveMethod · 0.80
dropMethod · 0.80
utils-spec.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected