release: bump version to 0.25.3
This commit is contained in:
55
frontend/public/earth/js/brand.js
Normal file
55
frontend/public/earth/js/brand.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const BRANDS = {
|
||||
zh: {
|
||||
ariaLabel: "智能星球计划品牌标识",
|
||||
titleAlt: "智能星球计划",
|
||||
titleSrc: "assets/brand/title-zh.png",
|
||||
subtitle: "现实层宇宙全息感知系统",
|
||||
description: "卫星 · 海底光缆 · 算力基础设施",
|
||||
},
|
||||
en: {
|
||||
ariaLabel: "Intelligent Planet Program brand banner",
|
||||
titleAlt: "Intelligent Planet Program",
|
||||
titleSrc: "assets/brand/title-en.png",
|
||||
subtitle: "Physical-Universe Holography",
|
||||
description: "Satellites · Cables · Compute Infra",
|
||||
},
|
||||
};
|
||||
|
||||
function getBrandConfig(variant = "zh") {
|
||||
return BRANDS[variant] ?? BRANDS.zh;
|
||||
}
|
||||
|
||||
export function renderBrand(variant = "zh") {
|
||||
const config = getBrandConfig(variant);
|
||||
|
||||
return `
|
||||
<div class="earth-brand earth-brand--${variant}" aria-label="${config.ariaLabel}">
|
||||
<img
|
||||
class="earth-brand__logo"
|
||||
src="assets/brand/earth-logo.png"
|
||||
alt=""
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div class="earth-brand__copy">
|
||||
<img
|
||||
class="earth-brand__title"
|
||||
src="${config.titleSrc}"
|
||||
alt="${config.titleAlt}"
|
||||
>
|
||||
<div class="earth-brand__meta">
|
||||
<span class="earth-brand__subtitle">${config.subtitle}</span>
|
||||
<span class="earth-brand__description">${config.description}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`.trim();
|
||||
}
|
||||
|
||||
export function mountBrand(target, variant = "zh") {
|
||||
if (!target) return;
|
||||
target.innerHTML = renderBrand(variant);
|
||||
}
|
||||
|
||||
export function getBrandVariants() {
|
||||
return Object.keys(BRANDS);
|
||||
}
|
||||
@@ -17,6 +17,7 @@ export const HUD_CONFIG = {
|
||||
scaleReferenceHeight: 1080,
|
||||
minScale: 0.7,
|
||||
maxScale: 1,
|
||||
brandLanguage: "zh",
|
||||
};
|
||||
|
||||
// Earth coordinate constants
|
||||
|
||||
@@ -123,6 +123,7 @@ import {
|
||||
refreshLegend,
|
||||
setLegendItems,
|
||||
} from "./legend.js";
|
||||
import { mountBrand } from "./brand.js";
|
||||
|
||||
export let scene;
|
||||
export let camera;
|
||||
@@ -853,6 +854,11 @@ export function init() {
|
||||
initialized = true;
|
||||
simplex = createNoise3D();
|
||||
updateHudScale();
|
||||
const brandRoot = document.getElementById("brand-root");
|
||||
mountBrand(
|
||||
brandRoot,
|
||||
HUD_CONFIG.brandLanguage || "zh",
|
||||
);
|
||||
|
||||
scene = new THREE.Scene();
|
||||
camera = new THREE.PerspectiveCamera(
|
||||
|
||||
Reference in New Issue
Block a user