Files
sundynix-pets/pets-fe/utils/layout.js
T
Blizzard c2b51f96e0
ci-cd / verify (push) Successful in 6s
ci-cd / deploy (push) Skipped
Fix capsule-aligned navigation and refresh mini program typography
2026-10-04 10:30:17 +08:00

20 lines
679 B
JavaScript

function navigationGeometry(info = {}, menu = {}) {
const width = info.windowWidth || 375;
const height = info.windowHeight || 812;
const status = info.statusBarHeight || 24;
const validMenu = menu.top >= status && menu.height > 0 && menu.left > 0 && menu.left < width;
const top = validMenu ? menu.top : status + 6;
const rowHeight = validMenu ? menu.height : 32;
const menuLeft = validMenu ? menu.left : width - 100;
const headerHeight = top + rowHeight + 12;
return {
top,
rowHeight,
titleWidth: Math.max(80, menuLeft - 28),
headerHeight,
scrollHeight: Math.max(0, height - headerHeight),
};
}
module.exports = { navigationGeometry };