refactor(web): split touch canvas adapters

This commit is contained in:
2026-04-01 11:09:26 +02:00
parent a4789d718b
commit 922394c56a
7 changed files with 114 additions and 58 deletions
@@ -0,0 +1,36 @@
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,
};
}