refactor(web): split touch canvas adapters
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user