Apply formatting changes

This commit is contained in:
eoghanmurray
2026-04-01 12:00:00 +08:00
committed by github-actions[bot]
parent 5a7b6d60ea
commit 1c069aac77

View File

@@ -244,7 +244,9 @@ function initMouseInteractionObserver({
if (MouseInteractions[eventKey] === MouseInteractions.MouseDown) { if (MouseInteractions[eventKey] === MouseInteractions.MouseDown) {
// we are actually listening on 'pointerdown' // we are actually listening on 'pointerdown'
eventKey = 'TouchStart'; eventKey = 'TouchStart';
} else if (MouseInteractions[eventKey] === MouseInteractions.MouseUp) { } else if (
MouseInteractions[eventKey] === MouseInteractions.MouseUp
) {
// we are actually listening on 'pointerup' // we are actually listening on 'pointerup'
eventKey = 'TouchEnd'; eventKey = 'TouchEnd';
} }
@@ -259,7 +261,7 @@ function initMouseInteractionObserver({
currentPointerType = pointerType; currentPointerType = pointerType;
} else if (MouseInteractions[eventKey] === MouseInteractions.Click) { } else if (MouseInteractions[eventKey] === MouseInteractions.Click) {
pointerType = currentPointerType; pointerType = currentPointerType;
currentPointerType = null; // cleanup as we've used it currentPointerType = null; // cleanup as we've used it
} }
if (!e) { if (!e) {
return; return;
@@ -271,7 +273,7 @@ function initMouseInteractionObserver({
id, id,
x: clientX, x: clientX,
y: clientY, y: clientY,
...pointerType && { pointerType } ...(pointerType && { pointerType }),
}); });
}; };
}; };
@@ -286,15 +288,15 @@ function initMouseInteractionObserver({
let eventName = eventKey.toLowerCase(); let eventName = eventKey.toLowerCase();
const handler = getHandler(eventKey); const handler = getHandler(eventKey);
if (window.PointerEvent) { if (window.PointerEvent) {
switch(MouseInteractions[eventKey]) { switch (MouseInteractions[eventKey]) {
case MouseInteractions.MouseDown: case MouseInteractions.MouseDown:
case MouseInteractions.MouseUp: case MouseInteractions.MouseUp:
eventName = eventName.replace('mouse', 'pointer'); eventName = eventName.replace('mouse', 'pointer');
break; break;
case MouseInteractions.TouchStart: case MouseInteractions.TouchStart:
case MouseInteractions.TouchEnd: case MouseInteractions.TouchEnd:
// these are handled by pointerdown/pointerup // these are handled by pointerdown/pointerup
return; return;
} }
} }
handlers.push(on(eventName, handler, doc)); handlers.push(on(eventName, handler, doc));