Record pointerType on clicks - could be useful for displaying e.g. a circle rather than a point during replay

- We have to switch to 'onpointerdown' & 'onpointerup' in order to actually capture `e.pointerType`
 - this replaces 4 event listeners (MouseDown/MouseUp/TouchStart/TouchEnd) with 2 pointer ones which should fire in all 4 scenarios. We still output the old types according to the MouseInteractions enum
 - there is no Pointer equivalent of Click, so we leave that is, but use the last Pointer event to attach a pointerType to (only) the click event, where it is most useful
 - we can fallback to the old method for any browsers not supporting `window.PointerEvent`, in which case \`pointerType\` will be absent from all events
This commit is contained in:
Eoghan Murray
2023-02-13 17:27:15 +00:00
parent 1b2855bde1
commit 351c5551da
3 changed files with 47 additions and 7 deletions

View File

@@ -404,6 +404,7 @@ type mouseInteractionParam = {
id: number;
x: number;
y: number;
pointerType?: string;
};
export type mouseInteractionCallBack = (d: mouseInteractionParam) => void;