decouple TOUCH from MOBILE

This commit is contained in:
Til 2026-05-15 12:48:07 +02:00
parent 8cdb6b80a1
commit eb42de3c39

View file

@ -1697,6 +1697,12 @@ window.onhashchange = function() {
} }
window.onpointerdown = function (e) {
TOUCH = e.pointerType === "touch"
console.log(e)
}
var m = SPINNER.split(','), var m = SPINNER.split(','),
SPINNER_CSS = SPINNER.slice(1 + m[0].length); SPINNER_CSS = SPINNER.slice(1 + m[0].length);
SPINNER = m[0]; SPINNER = m[0];
@ -2982,10 +2988,8 @@ var vbar = (function () {
if (e.button === 0) if (e.button === 0)
ebi('pvolbg').onmousemove = can.onmousemove = null; ebi('pvolbg').onmousemove = can.onmousemove = null;
}; };
if (TOUCH) { ebi('pvolbg').ontouchstart = can.ontouchstart = mousedown;
ebi('pvolbg').ontouchstart = can.ontouchstart = mousedown; ebi('pvolbg').ontouchmove = can.ontouchmove = mousemove;
ebi('pvolbg').ontouchmove = can.ontouchmove = mousemove;
}
var mute = ebi('pvolbg').children[0]; var mute = ebi('pvolbg').children[0];
mute.onclick = function (e) { mute.onclick = function (e) {
ev(e); ev(e);
@ -3177,32 +3181,30 @@ function mpause(e) {
seek_au_mul(this.value); seek_au_mul(this.value);
} }
if (!TOUCH) { bar.onwheel = function (e) {
bar.onwheel = function (e) { var dist = Math.sign(e.deltaY) * 10;
var dist = Math.sign(e.deltaY) * 10; if (Math.abs(e.deltaY) < 30 && !e.deltaMode)
if (Math.abs(e.deltaY) < 30 && !e.deltaMode) dist = e.deltaY;
dist = e.deltaY;
if (!dist || !mp.au) if (!dist || !mp.au)
return true; return true;
seek_au_rel(dist); seek_au_rel(dist);
ev(e); ev(e);
}; };
ebi('pvolbg').onwheel = function (e) { ebi('pvolbg').onwheel = function (e) {
var dist = Math.sign(e.deltaY) * 10; var dist = Math.sign(e.deltaY) * 10;
if (Math.abs(e.deltaY) < 30 && !e.deltaMode) if (Math.abs(e.deltaY) < 30 && !e.deltaMode)
dist = e.deltaY; dist = e.deltaY;
if (!dist) if (!dist)
return true; return true;
dist *= -1; dist *= -1;
mp.setvol(Math.round((mp.vol + dist / 250) * 100) / 100 ); mp.setvol(Math.round((mp.vol + dist / 250) * 100) / 100 );
vbar.draw(); vbar.draw();
ev(e); ev(e);
}; };
}
})(); })();
@ -9791,7 +9793,7 @@ var msel = (function () {
} }
r.selui(); r.selui();
if (MOBILE && thegrid.sel && msel.getsel().length == 0 && clgot(ebi('gridsel'), 'on') == false){ if (TOUCH && thegrid.sel && msel.getsel().length == 0 && clgot(ebi('gridsel'), 'on') == false){
thegrid.sel = false; thegrid.sel = false;
clmod(ebi('gridsel'), 'temp', false); clmod(ebi('gridsel'), 'temp', false);
} }
@ -10806,8 +10808,8 @@ var rcm = (function () {
clmod(shr, 'hide', !can_shr || !get_evpath().indexOf(have_shr)); clmod(shr, 'hide', !can_shr || !get_evpath().indexOf(have_shr));
shr.innerHTML = has_sel ? L.rc_shs : L.rc_shf; shr.innerHTML = has_sel ? L.rc_shs : L.rc_shf;
if (MOBILE) { clmod(menu, 'large', TOUCH);
clmod(menu, 'large', true); if (TOUCH) {
if (target && !forceopen){ if (target && !forceopen){
thegrid.sel = true; thegrid.sel = true;
clmod(ebi('gridsel'), 'temp', true); clmod(ebi('gridsel'), 'temp', true);
@ -10863,7 +10865,7 @@ var rcm = (function () {
var target = gfile || e.target; var target = gfile || e.target;
r.hide(true); r.hide(true);
if (MOBILE) if (TOUCH)
forceopen = !gfile || clgot(gfile, 'sel'); forceopen = !gfile || clgot(gfile, 'sel');
if (selFile.elem && !selFile.no_dsel) { if (selFile.elem && !selFile.no_dsel) {
clmod(selFile.elem, "sel", false); clmod(selFile.elem, "sel", false);