@zhsz/cool-design-dv
Version:
36 lines (35 loc) • 1.21 kB
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const vue = require("vue");
const color = require("../utils/color.js");
function useHeader($emit, color$1, page) {
const width = vue.ref(0);
const height = vue.ref(0);
const svgStyle = vue.computed(() => {
return {
zoom: width.value / 1920
};
});
const dark = vue.computed(() => {
const colorArray = color.getRgbaValue(color$1);
colorArray[3] = 0.3;
return `rgba(${colorArray.join(",")})`;
});
const light = vue.computed(() => {
const colorArray = color.getRgbaValue(color$1);
colorArray[3] = 0.6;
return `rgba(${colorArray.join(",")})`;
});
function resize($el) {
var _a, _b;
const rect = $el == null ? void 0 : $el.getBoundingClientRect();
if (!rect) {
return;
}
width.value = rect.width / (((_a = page == null ? void 0 : page.widthScale) == null ? void 0 : _a.value) ?? 1);
height.value = rect.height / (((_b = page == null ? void 0 : page.heightScale) == null ? void 0 : _b.value) ?? 1);
$emit("resize", [width.value, height.value]);
}
return { svgStyle, dark, light, resize, color: color$1 };
}
exports.useHeader = useHeader;