v0.6.5: size hero detail drawer from viewport; add PC post-lock item tips.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+43
-2
@@ -445,10 +445,40 @@ let detailDrawerDrag = null;
|
||||
let detailDrawerSuppressClickUntil = 0;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
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;
|
||||
return Math.max(DETAIL_DRAWER_MIN_H, Math.min(DETAIL_DRAWER_MAX_H, available));
|
||||
}
|
||||
|
||||
function applyDetailDrawerHeight() {
|
||||
const drawer = $("#detail-drawer");
|
||||
const h = detailDrawerTargetHeight();
|
||||
if (drawer) drawer.style.setProperty("--detail-fixed-h", `${h}px`);
|
||||
return h;
|
||||
}
|
||||
|
||||
function detailDrawerFullHeight() {
|
||||
const h = applyDetailDrawerHeight();
|
||||
const panel = $("#detail");
|
||||
if (panel && panel.offsetHeight) return panel.offsetHeight;
|
||||
return Math.min(720, Math.round((window.innerHeight || 800) * 0.88));
|
||||
return h;
|
||||
}
|
||||
|
||||
function syncDetailDrawer() {
|
||||
@@ -463,6 +493,7 @@ function syncDetailDrawer() {
|
||||
resetDetailDrawerDrag();
|
||||
return;
|
||||
}
|
||||
applyDetailDrawerHeight();
|
||||
drawer.classList.remove("is-collapsed");
|
||||
drawer.style.maxHeight = "";
|
||||
}
|
||||
@@ -6090,7 +6121,17 @@ async function main() {
|
||||
if (t.closest && t.closest(".skill-icon.talent-trigger")) return;
|
||||
closeTalentPopover();
|
||||
});
|
||||
window.addEventListener("resize", closeTalentPopover);
|
||||
window.addEventListener("resize", () => {
|
||||
closeTalentPopover();
|
||||
if (
|
||||
state.page === "heroes" &&
|
||||
state.selectedKey &&
|
||||
!detailDrawerClosing &&
|
||||
!detailDrawerDrag
|
||||
) {
|
||||
applyDetailDrawerHeight();
|
||||
}
|
||||
});
|
||||
document.addEventListener(
|
||||
"scroll",
|
||||
(e) => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Local defaults; production export overwrites via export_relations_site.py. */
|
||||
var SITE_VERSION = "0.6.4";
|
||||
var SITE_VERSION = "0.6.5";
|
||||
var SITE_ORIGIN = "";
|
||||
var ABILITY_VIDEO_BASE = "";
|
||||
var STATIC_ASSET_BASE = "";
|
||||
|
||||
@@ -43,8 +43,8 @@
|
||||
}
|
||||
</script>
|
||||
<link rel="icon" href="/ui-icon/dota2_logo.png" type="image/png" />
|
||||
<link rel="stylesheet" href="/style.css?v=0.6.4" />
|
||||
<script src="/mobile-gate.js?v=0.6.4"></script>
|
||||
<link rel="stylesheet" href="/style.css?v=0.6.5" />
|
||||
<script src="/mobile-gate.js?v=0.6.5"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="sr-only">DOTA2 上分帝</h1>
|
||||
@@ -233,8 +233,8 @@
|
||||
</div>
|
||||
<footer class="heroes-site-foot" id="heroes-site-foot" aria-hidden="true"></footer>
|
||||
|
||||
<script src="/config.js?v=0.6.4"></script>
|
||||
<script src="/router.js?v=0.6.4"></script>
|
||||
<script src="/app.js?v=0.6.4"></script>
|
||||
<script src="/config.js?v=0.6.5"></script>
|
||||
<script src="/router.js?v=0.6.5"></script>
|
||||
<script src="/app.js?v=0.6.5"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -477,9 +477,10 @@ body.detail-drawer-open .hero-role-toolbar {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* In-flow bottom drawer: height animates so the tagbar above is pushed up. */
|
||||
/* In-flow bottom drawer: height animates so the tagbar above is pushed up.
|
||||
Fallback reserves ~topbar + hero strip + role tags; JS may override --detail-fixed-h in px. */
|
||||
.detail-drawer {
|
||||
--detail-fixed-h: min(720px, 88dvh);
|
||||
--detail-fixed-h: min(640px, calc(100dvh - 17.5rem));
|
||||
flex: 0 0 auto;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
|
||||
Reference in New Issue
Block a user