take two on fix for touch + mouse on PC laptops

This commit is contained in:
Stewart Allen 2022-10-25 18:47:14 -04:00
commit bf2322649a

View file

@ -477,7 +477,9 @@ CAM.init = function(kiri, api) {
}
}
if (moto.space.info.mob) {
let touched = false;
el.ontouchstart = (ev) => {
touched = true;
if (poppedRec === rec && popped) {
onLeave(ev);
} else {
@ -486,6 +488,12 @@ CAM.init = function(kiri, api) {
};
el.ontouchmove = onDown;
el.onmouseenter = (ev) => {
if (touched) {
// touches block mouse events on touchscreen PCs
// which are often sent along with touch events
// but when not touched, allow the mouse to work
return;
}
el.onmousedown = onDown;
el.onmouseleave = onLeave;
onEnter(ev);