37 lines
813 B
TypeScript
37 lines
813 B
TypeScript
import type { TouchPoint } from "./timelineTouch.js";
|
|
|
|
export type TouchMouseDownEvent = {
|
|
button: number;
|
|
clientX: number;
|
|
currentTarget?: EventTarget | null;
|
|
shiftKey: boolean;
|
|
preventDefault: () => void;
|
|
stopPropagation: () => void;
|
|
};
|
|
|
|
export type TouchCanvasPointerEvent = {
|
|
clientX: number;
|
|
clientY: number;
|
|
};
|
|
|
|
export function createTouchMouseDownEvent(
|
|
point: TouchPoint,
|
|
currentTarget?: EventTarget | null,
|
|
): TouchMouseDownEvent {
|
|
return {
|
|
button: 0,
|
|
clientX: point.clientX,
|
|
currentTarget: currentTarget ?? null,
|
|
shiftKey: false,
|
|
preventDefault: () => {},
|
|
stopPropagation: () => {},
|
|
};
|
|
}
|
|
|
|
export function createTouchCanvasPointerEvent(point: TouchPoint): TouchCanvasPointerEvent {
|
|
return {
|
|
clientX: point.clientX,
|
|
clientY: point.clientY,
|
|
};
|
|
}
|