Files
NapCatQQ/.pnpm-store/v3/files/29/125e880d22a2fedfaf02379f11fb94ed46dcf4c9405ecee6521de28d0ca7354229cae6e3a643498dc1c43638b8769b20fe6409e3e00584be4ca6a5b340f427
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

24 lines
686 B
Plaintext

"use client";
// src/dimensions.ts
var getCSSStyleVal = (str, parentNum) => {
if (!str) return 0;
const strVal = str.includes("px") ? +str.split("px")[0] : str.includes("%") ? +str.split("%")[0] * parentNum * 0.01 : str;
return Number.isNaN(+strVal) ? 0 : +strVal;
};
var getRealShape = (el) => {
const defaultShape = { width: 0, height: 0 };
if (!el || typeof window === "undefined") return defaultShape;
const rect = el.getBoundingClientRect();
const { width, height } = window.getComputedStyle(el);
return {
width: getCSSStyleVal(`${width}`, rect.width),
height: getCSSStyleVal(`${height}`, rect.height)
};
};
export {
getCSSStyleVal,
getRealShape
};