adwaita-web
Version:
A GTK inspired toolkit designed to build awesome web apps
28 lines (27 loc) • 617 B
JavaScript
function trackFinger(event, touchId) {
if ("touches" in event) {
if (touchId.current !== void 0 && event.changedTouches) {
for (const index of Array.from(event.changedTouches).keys()) {
const touch = event.changedTouches[index];
if (touch?.identifier === touchId.current) {
return {
x: touch.clientX,
y: touch.clientY
};
}
}
return false;
}
return {
x: event.touches[0].clientX,
y: event.touches[0].clientY
};
}
return {
x: event.clientX,
y: event.clientY
};
}
export {
trackFinger
};