Add loading overlay while scenes initialize

- Show a spinner overlay that fades out once Cesium globe
  data is ready, with a 1s minimum and 8s timeout
- Expose a ready promise on CesiumGlobe resolved after country
  and city data load
- Remove temporary inspect script
This commit is contained in:
2026-09-19 01:18:15 +08:00
parent 58bc998c6e
commit 32bb48cc0b
5 changed files with 57 additions and 26 deletions
+13
View File
@@ -8,3 +8,16 @@ for (const ev of ['copy', 'cut', 'contextmenu']) {
// 启动应用
const app = new App();
window.__app = app; // 便于调试
// 加载界面:等三个视图初始化完成(最少展示 1 秒,最多等 8 秒)后淡出
const t0 = Date.now();
const MIN_DISPLAY = 1000;
Promise.race([
app.globe.ready,
new Promise((r) => setTimeout(r, 8000)),
]).then(() => {
const wait = Math.max(0, MIN_DISPLAY - (Date.now() - t0));
setTimeout(() => {
document.getElementById('loading').classList.add('hidden');
}, wait);
});