chore(bidi): pointerMove action needs to floor fractional values for x and y position.

For elements that are only 1 pixel in size, rounding can
cause the click to occur outside the element’s rect.

For example, a 1px div at (8,8) would not be reached if
the click is rounded to (9,9).
This commit is contained in:
Henrik Skupin 2025-01-02 12:27:25 +01:00 committed by Yury Semikhatsky
parent 8accb0ad1b
commit c062552ecb

View file

@ -79,8 +79,8 @@ 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> {
// Bidi throws when x/y are not integers.
x = Math.round(x);
y = Math.round(y);
x = Math.floor(x);
y = Math.floor(y);
await this._performActions([{ type: 'pointerMove', x, y }]);
}