Change event types from PointerEvent to MouseEvent in ProjectSchedulePane.tsx
This commit is contained in:
@@ -3,7 +3,7 @@ import {
|
|||||||
useRef,
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
type KeyboardEvent as ReactKeyboardEvent,
|
type KeyboardEvent as ReactKeyboardEvent,
|
||||||
type PointerEvent as ReactPointerEvent
|
type MouseEvent as ReactMouseEvent
|
||||||
} from "react";
|
} from "react";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -516,7 +516,7 @@ export function ProjectSequencerPane({
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const beginRoutineDrag = (
|
const beginRoutineDrag = (
|
||||||
event: ReactPointerEvent<HTMLElement>,
|
event: ReactMouseEvent<HTMLElement>,
|
||||||
routine: ProjectScheduleRoutine,
|
routine: ProjectScheduleRoutine,
|
||||||
mode: RoutineDragState["mode"]
|
mode: RoutineDragState["mode"]
|
||||||
) => {
|
) => {
|
||||||
@@ -550,7 +550,7 @@ export function ProjectSequencerPane({
|
|||||||
const previousUserSelect = document.body.style.userSelect;
|
const previousUserSelect = document.body.style.userSelect;
|
||||||
document.body.style.userSelect = "none";
|
document.body.style.userSelect = "none";
|
||||||
|
|
||||||
const handlePointerMove = (pointerEvent: PointerEvent) => {
|
const handlePointerMove = (pointerEvent: MouseEvent) => {
|
||||||
const currentDragState = routineDragStateRef.current;
|
const currentDragState = routineDragStateRef.current;
|
||||||
|
|
||||||
if (currentDragState === null) {
|
if (currentDragState === null) {
|
||||||
@@ -571,8 +571,8 @@ export function ProjectSequencerPane({
|
|||||||
const finalDragState = routineDragStateRef.current;
|
const finalDragState = routineDragStateRef.current;
|
||||||
|
|
||||||
document.body.style.userSelect = previousUserSelect;
|
document.body.style.userSelect = previousUserSelect;
|
||||||
window.removeEventListener("pointermove", handlePointerMove);
|
window.removeEventListener("mousemove", handlePointerMove);
|
||||||
window.removeEventListener("pointerup", handlePointerUp);
|
window.removeEventListener("mouseup", handlePointerUp);
|
||||||
routineDragCleanupRef.current = null;
|
routineDragCleanupRef.current = null;
|
||||||
setRoutineDragState(null);
|
setRoutineDragState(null);
|
||||||
routineDragStateRef.current = null;
|
routineDragStateRef.current = null;
|
||||||
@@ -602,13 +602,13 @@ export function ProjectSequencerPane({
|
|||||||
|
|
||||||
routineDragCleanupRef.current = () => {
|
routineDragCleanupRef.current = () => {
|
||||||
document.body.style.userSelect = previousUserSelect;
|
document.body.style.userSelect = previousUserSelect;
|
||||||
window.removeEventListener("pointermove", handlePointerMove);
|
window.removeEventListener("mousemove", handlePointerMove);
|
||||||
window.removeEventListener("pointerup", handlePointerUp);
|
window.removeEventListener("mouseup", handlePointerUp);
|
||||||
routineDragCleanupRef.current = null;
|
routineDragCleanupRef.current = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
window.addEventListener("pointermove", handlePointerMove);
|
window.addEventListener("mousemove", handlePointerMove);
|
||||||
window.addEventListener("pointerup", handlePointerUp);
|
window.addEventListener("mouseup", handlePointerUp);
|
||||||
routineDragStateRef.current = nextDragState;
|
routineDragStateRef.current = nextDragState;
|
||||||
setRoutineDragState(nextDragState);
|
setRoutineDragState(nextDragState);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user