mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 10:22:55 +08:00
fix(editor): touch event browser copability (#9437)
Fix: https://toeverything.sentry.io/issues/6180659644/events/82bf2e7bb8fc4ad69678261522b7fdf3/
This commit is contained in:
@@ -74,8 +74,12 @@ export function hasViewportRelativeCoordinates(
|
||||
return 'clientX' in event && 'clientY' in event;
|
||||
}
|
||||
|
||||
function isTouchEvent(event: Event): event is TouchEvent {
|
||||
return 'TouchEvent' in globalThis && event instanceof TouchEvent;
|
||||
}
|
||||
|
||||
const getEventCoordinates = (event: Event) => {
|
||||
if (event instanceof TouchEvent) {
|
||||
if (isTouchEvent(event)) {
|
||||
if (event.touches && event.touches.length) {
|
||||
const touch = event.touches[0];
|
||||
if (!touch) return;
|
||||
|
||||
Reference in New Issue
Block a user