(type: string, target: SimpleSelection<void>, relativeX: number, relativeY: number, button = 0)
| 185 | } |
| 186 | |
| 187 | export 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 | |
| 200 | export function triggerFakeDragSequence(target: SimpleSelection<void>, start: Plottable.Point, end: Plottable.Point, numSteps = 2) { |
| 201 | triggerFakeMouseEvent("mousedown", target, start.x, start.y); |
no outgoing calls
no test coverage detected