create wheel event remote

This commit is contained in:
Jörg Breitbart
2019-07-20 00:45:12 +02:00
parent 044476ae4f
commit 986bdac191
+6 -16
View File
@@ -83,25 +83,15 @@ async function mouseUp(button: "left" | "right" | "middle" | undefined): Promise
} }
async function wheelUp(): Promise<void> { async function wheelUp(): Promise<void> {
const self = (page.mouse as any); const self = (page.mouse as any);
return await self._client.send('Input.dispatchMouseEvent', { return await page.evaluate(`
type: 'mouseWheel', window.term.element.dispatchEvent(new WheelEvent('wheel', {clientX: ${self._x}, clientY: ${self._y}, deltaX: 0, deltaY: -10, modifiers: ${self._keyboard._modifiers}}));
x: self._x, `);
y: self._y,
deltaX: 0,
deltaY: -10,
modifiers: self._keyboard._modifiers
});
} }
async function wheelDown(): Promise<void> { async function wheelDown(): Promise<void> {
const self = (page.mouse as any); const self = (page.mouse as any);
return await self._client.send('Input.dispatchMouseEvent', { return await page.evaluate(`
type: 'mouseWheel', window.term.element.dispatchEvent(new WheelEvent('wheel', {clientX: ${self._x}, clientY: ${self._y}, deltaX: 0, deltaY: 10, modifiers: ${self._keyboard._modifiers}}));
x: self._x, `);
y: self._y,
deltaX: 0,
deltaY: 10,
modifiers: self._keyboard._modifiers
});
} }
// extract button data from buttonCode // extract button data from buttonCode