v0.6.6: size drawer from hero grid; drop skill video side bars.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+29
-10
@@ -414,6 +414,15 @@ function renderBoard() {
|
||||
col.appendChild(grid);
|
||||
root.appendChild(col);
|
||||
}
|
||||
// Filters change grid height; keep the open drawer from covering the last row.
|
||||
if (
|
||||
state.selectedKey &&
|
||||
!detailDrawerClosing &&
|
||||
!detailDrawerDrag &&
|
||||
!$("#detail-drawer")?.classList.contains("is-collapsed")
|
||||
) {
|
||||
applyDetailDrawerHeight();
|
||||
}
|
||||
}
|
||||
|
||||
function onHeroClick(key) {
|
||||
@@ -447,23 +456,33 @@ let detailDrawerClosing = false;
|
||||
|
||||
/** Cap / floor for the in-flow hero detail drawer (px). */
|
||||
const DETAIL_DRAWER_MAX_H = 640;
|
||||
const DETAIL_DRAWER_MIN_H = 320;
|
||||
const DETAIL_DRAWER_MIN_H = 280;
|
||||
|
||||
/** Natural height of the attr hero grid (content-sized; not the clipped viewport). */
|
||||
function heroesGridContentHeight() {
|
||||
const cols = $("#columns");
|
||||
if (!cols) return 0;
|
||||
const view = $("#heroes-view");
|
||||
let pad = 0;
|
||||
if (view) {
|
||||
const cs = getComputedStyle(view);
|
||||
pad = (parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0);
|
||||
}
|
||||
// offsetHeight is the laid-out grid even when #heroes-view is overflow-clipped.
|
||||
return Math.ceil(cols.offsetHeight + pad);
|
||||
}
|
||||
|
||||
/**
|
||||
* Height that leaves topbar + a usable hero-grid strip + role tags visible.
|
||||
* Prefer ~24% of the viewport for the grid; never steal the whole screen.
|
||||
* Drawer height = leftover after topbar + full hero grid + role tags.
|
||||
* Skills / other tabs flex+scroll inside; do not size the drawer for skill content.
|
||||
*/
|
||||
function detailDrawerTargetHeight() {
|
||||
const vh = window.innerHeight || 800;
|
||||
const topbar = document.querySelector(".topbar")?.offsetHeight || 60;
|
||||
const toolbar = document.querySelector(".hero-role-toolbar")?.offsetHeight || 52;
|
||||
const chrome = topbar + toolbar;
|
||||
const heroPrefer = Math.round(vh * 0.24);
|
||||
const heroReserve = Math.min(
|
||||
Math.max(140, heroPrefer),
|
||||
Math.max(120, vh - chrome - DETAIL_DRAWER_MIN_H)
|
||||
);
|
||||
const available = vh - chrome - heroReserve;
|
||||
const heroNeed = heroesGridContentHeight() || Math.round(vh * 0.36);
|
||||
const gap = 8;
|
||||
const available = vh - topbar - toolbar - heroNeed - gap;
|
||||
return Math.max(DETAIL_DRAWER_MIN_H, Math.min(DETAIL_DRAWER_MAX_H, available));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user