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

Function simulateMouseEvent

src/dd-touch.ts:48–58  ·  view source on GitHub ↗

* Simulate a mouse event based on a corresponding touch event * @param {Object} e A touch event * @param {String} simulatedType The corresponding mouse event

(e: TouchEvent, simulatedType: string)

Source from the content-addressed store, hash-verified

46 * @param {String} simulatedType The corresponding mouse event
47 */
48function simulateMouseEvent(e: TouchEvent, simulatedType: string) {
49
50 // Ignore multi-touch events
51 if (e.touches.length > 1) return;
52
53 // Prevent "Ignored attempt to cancel a touchmove event with cancelable=false" errors
54 if (e.cancelable) e.preventDefault();
55
56 // Dispatch the simulated event to the target element
57 Utils.simulateMouseEvent(e.changedTouches[0], simulatedType);
58}
59
60/**
61 * Simulate a mouse event based on a corresponding Pointer event

Callers 3

touchstartFunction · 0.85
touchmoveFunction · 0.85
touchendFunction · 0.85

Calls 1

simulateMouseEventMethod · 0.80

Tested by

no test coverage detected