in packages/bui-utils/src/hooks/useTouchEmulator.ts [60:94]
function onMouse(touchType) {
return function (ev) {
// prevent mouse events
if (ev.type === 'mousedown') {
initiated = true;
}
if (ev.type === 'mouseup') {
initiated = false;
}
if (ev.type === 'mousemove' && !initiated) {
return;
}
// The EventTarget on which the touch point started when it was first placed on the surface,
// even if the touch point has since moved outside the interactive area of that element.
// also, when the target doesnt exist anymore, we update it
if (
ev.type === 'mousedown' ||
!eventTarget ||
(eventTarget && !eventTarget.dispatchEvent)
) {
eventTarget = ev.target;
}
triggerTouch(touchType, ev);
// reset
if (ev.type === 'mouseup') {
eventTarget = null;
}
};
}