Skip to content

Commit

Permalink
Make properties x and y optional in mouseInteractionParam (rrweb-io#1375
Browse files Browse the repository at this point in the history
)

* 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
  • Loading branch information
avillegasn authored and jaj1014 committed Apr 30, 2024
1 parent 18cf303 commit 2cfbfd5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/rrweb/src/replay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1161,8 +1161,8 @@ export class Replayer {
this.lastMouseDownEvent = null;
}
this.mousePos = {
x: d.x,
y: d.y,
x: d.x || 0,
y: d.y || 0,
id: d.id,
debugData: d,
};
Expand All @@ -1171,7 +1171,7 @@ export class Replayer {
// don't draw a trail as user has lifted finger and is placing at a new point
this.tailPositions.length = 0;
}
this.moveAndHover(d.x, d.y, d.id, isSync, d);
this.moveAndHover(d.x || 0, d.y || 0, d.id, isSync, d);
if (d.type === MouseInteractions.Click) {
/*
* don't want target.click() here as could trigger an iframe navigation
Expand Down
4 changes: 2 additions & 2 deletions packages/types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,8 @@ export type CanvasArg =
type mouseInteractionParam = {
type: MouseInteractions;
id: number;
x: number;
y: number;
x?: number;
y?: number;
pointerType?: PointerTypes;
};

Expand Down

0 comments on commit 2cfbfd5

Please sign in to comment.