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:
@@ -69,6 +69,8 @@ export class CesiumGlobe {
|
||||
this.selected = -1;
|
||||
this._created = false;
|
||||
this._visible = false;
|
||||
this._pendingData = 2; // 国家边界 + 城市数据
|
||||
this.ready = new Promise((resolve) => { this._resolveReady = resolve; });
|
||||
}
|
||||
|
||||
ensureCreated() {
|
||||
@@ -316,6 +318,8 @@ export class CesiumGlobe {
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('[CesiumGlobe] 行政区划加载失败:', err);
|
||||
} finally {
|
||||
this._dataReady();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,6 +366,15 @@ export class CesiumGlobe {
|
||||
},
|
||||
});
|
||||
}
|
||||
this._dataReady();
|
||||
}
|
||||
|
||||
_dataReady() {
|
||||
this._pendingData--;
|
||||
if (this._pendingData <= 0 && this._resolveReady) {
|
||||
this._resolveReady();
|
||||
this._resolveReady = null;
|
||||
}
|
||||
}
|
||||
|
||||
setSelected(index) {
|
||||
|
||||
Reference in New Issue
Block a user