mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 01:22:13 -06:00
optimize window resizing
This commit is contained in:
parent
dbabeb9692
commit
e40cd2a809
|
@ -703,8 +703,12 @@ var widget = (function () {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
clmod(document.documentElement, 'np_open', is_open);
|
clmod(document.documentElement, 'np_open', is_open);
|
||||||
widget.className = is_open ? 'open' : '';
|
clmod(widget, 'open', is_open);
|
||||||
bcfg_set('au_open', r.is_open = is_open);
|
bcfg_set('au_open', r.is_open = is_open);
|
||||||
|
if (window.vbar) {
|
||||||
|
pbar.onresize();
|
||||||
|
vbar.onresize();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
r.toggle = function (e) {
|
r.toggle = function (e) {
|
||||||
|
@ -753,7 +757,7 @@ var widget = (function () {
|
||||||
};
|
};
|
||||||
r.set(sread('au_open') == 1);
|
r.set(sread('au_open') == 1);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
clmod(ebi('widget'), 'anim', 1);
|
clmod(widget, 'anim', 1);
|
||||||
}, 10);
|
}, 10);
|
||||||
return r;
|
return r;
|
||||||
})();
|
})();
|
||||||
|
@ -794,6 +798,9 @@ var pbar = (function () {
|
||||||
grad;
|
grad;
|
||||||
|
|
||||||
r.onresize = function () {
|
r.onresize = function () {
|
||||||
|
if (!widget.is_open && r.buf)
|
||||||
|
return;
|
||||||
|
|
||||||
r.buf = canvas_cfg(ebi('barbuf'));
|
r.buf = canvas_cfg(ebi('barbuf'));
|
||||||
r.pos = canvas_cfg(ebi('barpos'));
|
r.pos = canvas_cfg(ebi('barpos'));
|
||||||
r.drawbuf();
|
r.drawbuf();
|
||||||
|
@ -895,6 +902,9 @@ var vbar = (function () {
|
||||||
can, ctx, w, h, grad1, grad2;
|
can, ctx, w, h, grad1, grad2;
|
||||||
|
|
||||||
r.onresize = function () {
|
r.onresize = function () {
|
||||||
|
if (!widget.is_open && r.can)
|
||||||
|
return;
|
||||||
|
|
||||||
r.can = canvas_cfg(ebi('pvol'));
|
r.can = canvas_cfg(ebi('pvol'));
|
||||||
can = r.can.can;
|
can = r.can.can;
|
||||||
ctx = r.can.ctx;
|
ctx = r.can.ctx;
|
||||||
|
|
|
@ -1933,6 +1933,7 @@ function up2k_init(subtle) {
|
||||||
//
|
//
|
||||||
|
|
||||||
function onresize(e) {
|
function onresize(e) {
|
||||||
|
// 10x faster than matchMedia('(min-width
|
||||||
var bar = ebi('ops'),
|
var bar = ebi('ops'),
|
||||||
wpx = window.innerWidth,
|
wpx = window.innerWidth,
|
||||||
fpx = parseInt(getComputedStyle(bar)['font-size']),
|
fpx = parseInt(getComputedStyle(bar)['font-size']),
|
||||||
|
@ -1942,7 +1943,6 @@ function up2k_init(subtle) {
|
||||||
parent = ebi(wide && write ? 'u2btn_cw' : 'u2btn_ct'),
|
parent = ebi(wide && write ? 'u2btn_cw' : 'u2btn_ct'),
|
||||||
btn = ebi('u2btn');
|
btn = ebi('u2btn');
|
||||||
|
|
||||||
//console.log([wpx, fpx, wem]);
|
|
||||||
if (btn.parentNode !== parent) {
|
if (btn.parentNode !== parent) {
|
||||||
parent.appendChild(btn);
|
parent.appendChild(btn);
|
||||||
ebi('u2conf').setAttribute('class', wide);
|
ebi('u2conf').setAttribute('class', wide);
|
||||||
|
|
Loading…
Reference in a new issue