Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix touch events #11265

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions web/src/components/timeline/SummaryTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions web/src/hooks/use-draggable-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion web/src/views/live/LiveCameraView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading