diff --git a/web/src/components/timeline/SummaryTimeline.tsx b/web/src/components/timeline/SummaryTimeline.tsx index 54573c4f4..db1200546 100644 --- a/web/src/components/timeline/SummaryTimeline.tsx +++ b/web/src/components/timeline/SummaryTimeline.tsx @@ -187,7 +187,7 @@ export function SummaryTimeline({ e.stopPropagation(); let clientY; - if (e.nativeEvent instanceof TouchEvent) { + if ("TouchEvent" in window && e.nativeEvent instanceof TouchEvent) { clientY = e.nativeEvent.touches[0].clientY; } else if (e.nativeEvent instanceof MouseEvent) { clientY = e.nativeEvent.clientY; @@ -238,7 +238,7 @@ export function SummaryTimeline({ setIsDragging(true); let clientY; - if (e.nativeEvent instanceof TouchEvent) { + if ("TouchEvent" in window && e.nativeEvent instanceof TouchEvent) { clientY = e.nativeEvent.touches[0].clientY; } else if (e.nativeEvent instanceof MouseEvent) { clientY = e.nativeEvent.clientY; @@ -276,7 +276,7 @@ export function SummaryTimeline({ } e.stopPropagation(); let clientY; - if (e instanceof TouchEvent) { + if ("TouchEvent" in window && e instanceof TouchEvent) { clientY = e.touches[0].clientY; } else if (e instanceof MouseEvent) { clientY = e.clientY; diff --git a/web/src/hooks/use-draggable-element.ts b/web/src/hooks/use-draggable-element.ts index f18cae152..8cc61d451 100644 --- a/web/src/hooks/use-draggable-element.ts +++ b/web/src/hooks/use-draggable-element.ts @@ -87,7 +87,7 @@ function useDraggableElement({ const getClientYPosition = useCallback( (e: MouseEvent | TouchEvent) => { let clientY; - if (e instanceof TouchEvent) { + if ("TouchEvent" in window && e instanceof TouchEvent) { clientY = e.touches[0].clientY; } else if (e instanceof MouseEvent) { clientY = e.clientY; @@ -113,7 +113,7 @@ function useDraggableElement({ setIsDragging(true); let clientY; - if (e.nativeEvent instanceof TouchEvent) { + if ("TouchEvent" in window && e.nativeEvent instanceof TouchEvent) { clientY = e.nativeEvent.touches[0].clientY; } else if (e.nativeEvent instanceof MouseEvent) { clientY = e.nativeEvent.clientY; diff --git a/web/src/views/live/LiveCameraView.tsx b/web/src/views/live/LiveCameraView.tsx index bc27234bb..aef3453e7 100644 --- a/web/src/views/live/LiveCameraView.tsx +++ b/web/src/views/live/LiveCameraView.tsx @@ -98,7 +98,7 @@ export default function LiveCameraView({ camera }: LiveCameraViewProps) { let clientX; let clientY; - if (e.nativeEvent instanceof TouchEvent) { + if ("TouchEvent" in window && e.nativeEvent instanceof TouchEvent) { clientX = e.nativeEvent.touches[0].clientX; clientY = e.nativeEvent.touches[0].clientY; } else if (e.nativeEvent instanceof MouseEvent) {