Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
19 lines
616 B
Plaintext
19 lines
616 B
Plaintext
const isPrimaryPointer = (event) => {
|
|
if (event.pointerType === "mouse") {
|
|
return typeof event.button !== "number" || event.button <= 0;
|
|
}
|
|
else {
|
|
/**
|
|
* isPrimary is true for all mice buttons, whereas every touch point
|
|
* is regarded as its own input. So subsequent concurrent touch points
|
|
* will be false.
|
|
*
|
|
* Specifically match against false here as incomplete versions of
|
|
* PointerEvents in very old browser might have it set as undefined.
|
|
*/
|
|
return event.isPrimary !== false;
|
|
}
|
|
};
|
|
|
|
export { isPrimaryPointer };
|