feat: the + joins a lone file pane's top bar, beside Обновить and above the delete button, growing in smoothly
This commit is contained in:
1 parent
f2740c50b4
commit
2009796421
2 files changed
+21
-1
No files matched your search
@@ -101,6 +101,8 @@
|
||||
t.el.scrollIntoView({ block: 'nearest', inline: 'nearest', behavior: 'smooth' });
|
||||
if (desk && activePane) activePane.focus();
|
||||
updateMode();
|
||||
// The tab comes in moving a little; the "+" goes by where it ends up.
|
||||
setTimeout(placeFloat, 260);
|
||||
}
|
||||
function setActivePane(s) {
|
||||
activePane = s;
|
||||
@@ -118,6 +120,20 @@
|
||||
// The corner "+" moves down out of the way of a split tab's title bars.
|
||||
function syncFloat() {
|
||||
document.body.classList.toggle('split1', tabs.length === 1 && tabs[0].panes.length > 1);
|
||||
placeFloat();
|
||||
}
|
||||
// With one tab and a file pane in the top right corner, the "+" joins
|
||||
// that pane's top bar: right of "Обновить", above "Удалить выбранное",
|
||||
// a button of the same size. Otherwise it is back in the corner.
|
||||
function placeFloat() {
|
||||
const p = tabs.length === 1 ? tabs[0].panes.find(s => s.el.classList.contains('under-plus')) : null;
|
||||
const bars = p && /files$/.test(p.kind) ? p.el.querySelectorAll('.fm-bar') : [];
|
||||
const on = bars.length > 1 && bars[0].offsetParent !== null;
|
||||
floatAdd.classList.toggle('in-files', on);
|
||||
if (!on) { floatAdd.style.top = floatAdd.style.right = ''; return; }
|
||||
const a = area.getBoundingClientRect(), top = bars[0].getBoundingClientRect(), row = bars[1].getBoundingClientRect();
|
||||
floatAdd.style.top = (top.top - a.top - area.clientTop) + 'px';
|
||||
floatAdd.style.right = (a.left + area.clientLeft + area.clientWidth - row.right) + 'px';
|
||||
}
|
||||
// One tab: a plain terminal, the strip folded into the corner "+".
|
||||
function updateMode() {
|
||||
@@ -223,7 +239,7 @@
|
||||
g.style.left = d.x + 'px'; g.style.top = d.y + 'px'; g.style.width = d.w + 'px'; g.style.height = d.h + 'px';
|
||||
});
|
||||
clearTimeout(t.fitTimer);
|
||||
t.fitTimer = setTimeout(() => t.panes.forEach(s => s.fit()), animate ? 270 : 0);
|
||||
t.fitTimer = setTimeout(() => { t.panes.forEach(s => s.fit()); placeFloat(); }, animate ? 270 : 0);
|
||||
}
|
||||
function startResize(ev, t, g) {
|
||||
ev.preventDefault();
|
||||
|
||||
Reference in new issue
Block a user