The type system was complaining about the remote possibility that e ended up as a TouchEvent instead of an individual Touch object I think
This commit is contained in:
@@ -238,11 +238,12 @@ function initMouseInteractionObserver({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let pointerType: PointerTypes | null = null;
|
let pointerType: PointerTypes | null = null;
|
||||||
let e = event;
|
if ('pointerType' in event) {
|
||||||
if ('pointerType' in e) {
|
|
||||||
Object.keys(PointerTypes).forEach(
|
Object.keys(PointerTypes).forEach(
|
||||||
(pointerKey: keyof typeof PointerTypes) => {
|
(pointerKey: keyof typeof PointerTypes) => {
|
||||||
if ((e as PointerEvent).pointerType === pointerKey.toLowerCase()) {
|
if (
|
||||||
|
(event as PointerEvent).pointerType === pointerKey.toLowerCase()
|
||||||
|
) {
|
||||||
pointerType = PointerTypes[pointerKey];
|
pointerType = PointerTypes[pointerKey];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -262,7 +263,6 @@ function initMouseInteractionObserver({
|
|||||||
// TODO: these will get incorrectly emitted as MouseDown/MouseUp
|
// TODO: these will get incorrectly emitted as MouseDown/MouseUp
|
||||||
}
|
}
|
||||||
} else if (legacy_isTouchEvent(event)) {
|
} else if (legacy_isTouchEvent(event)) {
|
||||||
e = event.changedTouches[0];
|
|
||||||
pointerType = PointerTypes.Touch;
|
pointerType = PointerTypes.Touch;
|
||||||
}
|
}
|
||||||
if (pointerType !== null) {
|
if (pointerType !== null) {
|
||||||
@@ -271,6 +271,7 @@ function initMouseInteractionObserver({
|
|||||||
pointerType = currentPointerType;
|
pointerType = currentPointerType;
|
||||||
currentPointerType = null; // cleanup as we've used it
|
currentPointerType = null; // cleanup as we've used it
|
||||||
}
|
}
|
||||||
|
const e = legacy_isTouchEvent(event) ? event.changedTouches[0] : event;
|
||||||
if (!e) {
|
if (!e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user