positioning + optimization

This commit is contained in:
ed 2021-11-06 00:06:14 +01:00
parent 64304a9d65
commit 970badce66
2 changed files with 23 additions and 7 deletions

View file

@ -673,13 +673,13 @@ input.eq_gain {
border-bottom: 1px solid #111; border-bottom: 1px solid #111;
overflow: hidden; overflow: hidden;
} }
#tree #treepar { #treepar {
z-index: 1; z-index: 1;
position: fixed; position: fixed;
margin-top: -3px; left: -.75em;
margin-left: -2em; width: calc(var(--nav-sz) - 0.5em);
width: calc(var(--nav-sz) + 0.5em);
border-bottom: 1px solid #444; border-bottom: 1px solid #444;
overflow: hidden;
} }
#tree, #treeh { #tree, #treeh {
border-radius: 0 .3em 0 0; border-radius: 0 .3em 0 0;

View file

@ -3397,11 +3397,20 @@ var treectl = (function () {
var tree = ebi('tree'), var tree = ebi('tree'),
wrap = ebi('wrap'), wrap = ebi('wrap'),
wraptop = null,
atop = wrap.getBoundingClientRect().top, atop = wrap.getBoundingClientRect().top,
winh = window.innerHeight, winh = window.innerHeight,
parp = ebi('treepar'), parp = ebi('treepar'),
y = tree.scrollTop; y = tree.scrollTop,
w = tree.offsetWidth;
if (atop !== prev_atop || winh !== prev_winh)
wraptop = Math.floor(wrap.offsetTop);
if (r.parpane && r.pdir.length && w != r.pdirw) {
r.pdirw = w;
compy();
}
if (!r.parpane || !r.pdir.length || y > r.pdir.slice(-1)[0][0] || y < r.pdir[0][0]) { if (!r.parpane || !r.pdir.length || y > r.pdir.slice(-1)[0][0] || y < r.pdir[0][0]) {
parp.style.display = 'none'; parp.style.display = 'none';
@ -3427,9 +3436,16 @@ var treectl = (function () {
for (var a = 0, aa = els.length; a < aa; a++) for (var a = 0, aa = els.length; a < aa; a++)
els[a].onclick = bad_proxy; els[a].onclick = bad_proxy;
} }
y = ebi('treeh').offsetHeight;
if (!fixedpos)
y += tree.offsetTop - document.documentElement.scrollTop;
y = (y - 3) + 'px';
if (parp.style.top != y)
parp.style.top = y;
} }
if (atop === prev_atop && winh === prev_winh) if (wraptop === null)
return; return;
prev_atop = atop; prev_atop = atop;
@ -3450,7 +3466,7 @@ var treectl = (function () {
tree.style.top = Math.max(0, parseInt(atop)) + 'px'; tree.style.top = Math.max(0, parseInt(atop)) + 'px';
} }
else { else {
var top = Math.max(0, parseInt(wrap.offsetTop)), var top = Math.max(0, wraptop),
treeh = winh - atop; treeh = winh - atop;
tree.style.top = top + 'px'; tree.style.top = top + 'px';