mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-11 13:45:25 +03:00
support desktop touchscreens
This commit is contained in:
parent
ad87f5786e
commit
1034897b88
@ -9,7 +9,6 @@ import {
|
|||||||
import { SummarySegment } from "./SummarySegment";
|
import { SummarySegment } from "./SummarySegment";
|
||||||
import { useTimelineUtils } from "@/hooks/use-timeline-utils";
|
import { useTimelineUtils } from "@/hooks/use-timeline-utils";
|
||||||
import { ReviewSegment, ReviewSeverity } from "@/types/review";
|
import { ReviewSegment, ReviewSeverity } from "@/types/review";
|
||||||
import { isMobile } from "react-device-detect";
|
|
||||||
|
|
||||||
export type SummaryTimelineProps = {
|
export type SummaryTimelineProps = {
|
||||||
reviewTimelineRef: RefObject<HTMLDivElement>;
|
reviewTimelineRef: RefObject<HTMLDivElement>;
|
||||||
@ -188,7 +187,7 @@ export function SummaryTimeline({
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
let clientY;
|
let clientY;
|
||||||
if (isMobile && e.nativeEvent instanceof TouchEvent) {
|
if (e.nativeEvent instanceof TouchEvent) {
|
||||||
clientY = e.nativeEvent.touches[0].clientY;
|
clientY = e.nativeEvent.touches[0].clientY;
|
||||||
} else if (e.nativeEvent instanceof MouseEvent) {
|
} else if (e.nativeEvent instanceof MouseEvent) {
|
||||||
clientY = e.nativeEvent.clientY;
|
clientY = e.nativeEvent.clientY;
|
||||||
@ -239,7 +238,7 @@ export function SummaryTimeline({
|
|||||||
setIsDragging(true);
|
setIsDragging(true);
|
||||||
|
|
||||||
let clientY;
|
let clientY;
|
||||||
if (isMobile && e.nativeEvent instanceof TouchEvent) {
|
if (e.nativeEvent instanceof TouchEvent) {
|
||||||
clientY = e.nativeEvent.touches[0].clientY;
|
clientY = e.nativeEvent.touches[0].clientY;
|
||||||
} else if (e.nativeEvent instanceof MouseEvent) {
|
} else if (e.nativeEvent instanceof MouseEvent) {
|
||||||
clientY = e.nativeEvent.clientY;
|
clientY = e.nativeEvent.clientY;
|
||||||
@ -277,7 +276,7 @@ export function SummaryTimeline({
|
|||||||
}
|
}
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
let clientY;
|
let clientY;
|
||||||
if (isMobile && e instanceof TouchEvent) {
|
if (e instanceof TouchEvent) {
|
||||||
clientY = e.touches[0].clientY;
|
clientY = e.touches[0].clientY;
|
||||||
} else if (e instanceof MouseEvent) {
|
} else if (e instanceof MouseEvent) {
|
||||||
clientY = e.clientY;
|
clientY = e.clientY;
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { ReactNode, useCallback, useEffect, useMemo, useState } from "react";
|
import { ReactNode, useCallback, useEffect, useMemo, useState } from "react";
|
||||||
import { isMobile } from "react-device-detect";
|
|
||||||
import scrollIntoView from "scroll-into-view-if-needed";
|
import scrollIntoView from "scroll-into-view-if-needed";
|
||||||
import { useTimelineUtils } from "./use-timeline-utils";
|
import { useTimelineUtils } from "./use-timeline-utils";
|
||||||
|
|
||||||
@ -88,7 +87,7 @@ function useDraggableElement({
|
|||||||
const getClientYPosition = useCallback(
|
const getClientYPosition = useCallback(
|
||||||
(e: MouseEvent | TouchEvent) => {
|
(e: MouseEvent | TouchEvent) => {
|
||||||
let clientY;
|
let clientY;
|
||||||
if (isMobile && e instanceof TouchEvent) {
|
if (e instanceof TouchEvent) {
|
||||||
clientY = e.touches[0].clientY;
|
clientY = e.touches[0].clientY;
|
||||||
} else if (e instanceof MouseEvent) {
|
} else if (e instanceof MouseEvent) {
|
||||||
clientY = e.clientY;
|
clientY = e.clientY;
|
||||||
@ -114,7 +113,7 @@ function useDraggableElement({
|
|||||||
setIsDragging(true);
|
setIsDragging(true);
|
||||||
|
|
||||||
let clientY;
|
let clientY;
|
||||||
if (isMobile && e.nativeEvent instanceof TouchEvent) {
|
if (e.nativeEvent instanceof TouchEvent) {
|
||||||
clientY = e.nativeEvent.touches[0].clientY;
|
clientY = e.nativeEvent.touches[0].clientY;
|
||||||
} else if (e.nativeEvent instanceof MouseEvent) {
|
} else if (e.nativeEvent instanceof MouseEvent) {
|
||||||
clientY = e.nativeEvent.clientY;
|
clientY = e.nativeEvent.clientY;
|
||||||
|
|||||||
@ -98,7 +98,7 @@ export default function LiveCameraView({ camera }: LiveCameraViewProps) {
|
|||||||
|
|
||||||
let clientX;
|
let clientX;
|
||||||
let clientY;
|
let clientY;
|
||||||
if (isMobile && e.nativeEvent instanceof TouchEvent) {
|
if (e.nativeEvent instanceof TouchEvent) {
|
||||||
clientX = e.nativeEvent.touches[0].clientX;
|
clientX = e.nativeEvent.touches[0].clientX;
|
||||||
clientY = e.nativeEvent.touches[0].clientY;
|
clientY = e.nativeEvent.touches[0].clientY;
|
||||||
} else if (e.nativeEvent instanceof MouseEvent) {
|
} else if (e.nativeEvent instanceof MouseEvent) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user