mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: wheel input in bidi (#32499)
This commit is contained in:
parent
37bc485827
commit
f3ada9c654
@ -76,7 +76,7 @@ export class RawMouseImpl implements input.RawMouse {
|
||||
}
|
||||
|
||||
async move(x: number, y: number, button: types.MouseButton | 'none', buttons: Set<types.MouseButton>, modifiers: Set<types.KeyboardModifier>, forClick: boolean): Promise<void> {
|
||||
// TODO: bidi throws when x/y are not integers.
|
||||
// Bidi throws when x/y are not integers.
|
||||
x = Math.round(x);
|
||||
y = Math.round(y);
|
||||
await this._performActions([{ type: 'pointerMove', x, y }]);
|
||||
@ -91,6 +91,19 @@ export class RawMouseImpl implements input.RawMouse {
|
||||
}
|
||||
|
||||
async wheel(x: number, y: number, buttons: Set<types.MouseButton>, modifiers: Set<types.KeyboardModifier>, deltaX: number, deltaY: number): Promise<void> {
|
||||
// Bidi throws when x/y are not integers.
|
||||
x = Math.round(x);
|
||||
y = Math.round(y);
|
||||
await this._session.send('input.performActions', {
|
||||
context: this._session.sessionId,
|
||||
actions: [
|
||||
{
|
||||
type: 'wheel',
|
||||
id: 'pw_mouse_wheel',
|
||||
actions: [{ type: 'scroll', x, y, deltaX, deltaY }],
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
private async _performActions(actions: bidi.Input.PointerSourceAction[]) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user