refactor: clean up earth brand component wiring
This commit is contained in:
@@ -86,13 +86,11 @@
|
||||
}
|
||||
|
||||
.hud-panel-info .earth-brand--en .earth-brand__subtitle {
|
||||
font-size: calc(0.84rem * var(--hud-scale));
|
||||
line-height: 1.26;
|
||||
letter-spacing: 0.01em;
|
||||
}
|
||||
|
||||
.hud-panel-info .earth-brand--en .earth-brand__description {
|
||||
font-size: calc(0.66rem * var(--hud-scale));
|
||||
line-height: 1.24;
|
||||
letter-spacing: 0.045em;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
const DEFAULT_BRAND_LANGUAGE = "zh";
|
||||
|
||||
const BRANDS = {
|
||||
zh: {
|
||||
ariaLabel: "智能星球计划品牌标识",
|
||||
@@ -15,11 +17,11 @@ const BRANDS = {
|
||||
},
|
||||
};
|
||||
|
||||
function getBrandConfig(variant = "zh") {
|
||||
return BRANDS[variant] ?? BRANDS.zh;
|
||||
function getBrandConfig(variant = DEFAULT_BRAND_LANGUAGE) {
|
||||
return BRANDS[variant] ?? BRANDS[DEFAULT_BRAND_LANGUAGE];
|
||||
}
|
||||
|
||||
export function renderBrand(variant = "zh") {
|
||||
export function renderBrand(variant = DEFAULT_BRAND_LANGUAGE) {
|
||||
const config = getBrandConfig(variant);
|
||||
|
||||
return `
|
||||
@@ -45,11 +47,7 @@ export function renderBrand(variant = "zh") {
|
||||
`.trim();
|
||||
}
|
||||
|
||||
export function mountBrand(target, variant = "zh") {
|
||||
export function mountBrand(target, variant = DEFAULT_BRAND_LANGUAGE) {
|
||||
if (!target) return;
|
||||
target.innerHTML = renderBrand(variant);
|
||||
}
|
||||
|
||||
export function getBrandVariants() {
|
||||
return Object.keys(BRANDS);
|
||||
}
|
||||
|
||||
@@ -855,10 +855,7 @@ export function init() {
|
||||
simplex = createNoise3D();
|
||||
updateHudScale();
|
||||
const brandRoot = document.getElementById("brand-root");
|
||||
mountBrand(
|
||||
brandRoot,
|
||||
HUD_CONFIG.brandLanguage || "zh",
|
||||
);
|
||||
mountBrand(brandRoot, HUD_CONFIG.brandLanguage);
|
||||
|
||||
scene = new THREE.Scene();
|
||||
camera = new THREE.PerspectiveCamera(
|
||||
|
||||
Reference in New Issue
Block a user