Skip to content

Commit 5844f60

Browse files
authored
Make properties x and y optional in mouseInteractionParam (rrweb-io#1375)
* Make properties x and y optional in mouseInteractionParam The event representing a mouse interaction of focus an element does not include the properties x and y. Thus, they must be defined as optional. * Fix typings
1 parent fc2feee commit 5844f60

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/rrweb/src/replay/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,8 +1161,8 @@ export class Replayer {
11611161
this.lastMouseDownEvent = null;
11621162
}
11631163
this.mousePos = {
1164-
x: d.x,
1165-
y: d.y,
1164+
x: d.x || 0,
1165+
y: d.y || 0,
11661166
id: d.id,
11671167
debugData: d,
11681168
};
@@ -1171,7 +1171,7 @@ export class Replayer {
11711171
// don't draw a trail as user has lifted finger and is placing at a new point
11721172
this.tailPositions.length = 0;
11731173
}
1174-
this.moveAndHover(d.x, d.y, d.id, isSync, d);
1174+
this.moveAndHover(d.x || 0, d.y || 0, d.id, isSync, d);
11751175
if (d.type === MouseInteractions.Click) {
11761176
/*
11771177
* don't want target.click() here as could trigger an iframe navigation

packages/types/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,8 @@ export type CanvasArg =
417417
type mouseInteractionParam = {
418418
type: MouseInteractions;
419419
id: number;
420-
x: number;
421-
y: number;
420+
x?: number;
421+
y?: number;
422422
pointerType?: PointerTypes;
423423
};
424424

0 commit comments

Comments
 (0)