MCPcopy
hub / github.com/palantir/plottable / triggerFakeMouseEvent

Function triggerFakeMouseEvent

test/testMethods.ts:187–198  ·  view source on GitHub ↗
(type: string, target: SimpleSelection<void>, relativeX: number, relativeY: number, button = 0)

Source from the content-addressed store, hash-verified

185}
186
187export function triggerFakeMouseEvent(type: string, target: SimpleSelection<void>, relativeX: number, relativeY: number, button = 0) {
188 const clientRect = (<Element> target.node()).getBoundingClientRect();
189 const xPos = clientRect.left + relativeX;
190 const yPos = clientRect.top + relativeY;
191 const e = <MouseEvent> document.createEvent("MouseEvents");
192 e.initMouseEvent(type, true, true, window, 1,
193 xPos, yPos,
194 xPos, yPos,
195 false, false, false, false,
196 button, null);
197 (<HTMLElement> target.node()).dispatchEvent(e);
198}
199
200export function triggerFakeDragSequence(target: SimpleSelection<void>, start: Plottable.Point, end: Plottable.Point, numSteps = 2) {
201 triggerFakeMouseEvent("mousedown", target, start.x, start.y);

Callers 2

triggerFakeDragSequenceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected