fix: polish earth toolbar controls and loading copy
This commit is contained in:
2
frontend/public/earth/js/controls.js
vendored
2
frontend/public/earth/js/controls.js
vendored
@@ -371,7 +371,7 @@ function updateRotateUI() {
|
||||
const btn = document.getElementById("rotate-toggle");
|
||||
if (btn) {
|
||||
btn.classList.toggle("active", autoRotate);
|
||||
btn.innerHTML = autoRotate ? "⏸️" : "▶️";
|
||||
btn.classList.toggle("is-stopped", !autoRotate);
|
||||
const tooltip = btn.querySelector(".tooltip");
|
||||
if (tooltip) tooltip.textContent = autoRotate ? "暂停旋转" : "开始旋转";
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
updateZoomDisplay,
|
||||
updateEarthStats,
|
||||
setLoading,
|
||||
setLoadingMessage,
|
||||
showTooltip,
|
||||
hideTooltip,
|
||||
showError,
|
||||
@@ -392,6 +393,12 @@ async function loadData(showWhiteSphere = false) {
|
||||
const loadToken = ++currentLoadToken;
|
||||
isDataLoading = true;
|
||||
hideError();
|
||||
setLoadingMessage(
|
||||
showWhiteSphere ? "正在刷新全球态势数据..." : "正在初始化全球态势数据...",
|
||||
showWhiteSphere
|
||||
? "重新同步卫星、海底光缆与登陆点数据"
|
||||
: "同步卫星、海底光缆与登陆点数据",
|
||||
);
|
||||
setLoading(true);
|
||||
clearLockedObject();
|
||||
hideInfoCard();
|
||||
@@ -761,11 +768,19 @@ function animate() {
|
||||
|
||||
const earth = getEarth();
|
||||
const deltaTime = clock.getDelta() * 1000;
|
||||
const hasInertia =
|
||||
Math.abs(inertialVelocity.x) > INERTIA_MIN_VELOCITY ||
|
||||
Math.abs(inertialVelocity.y) > INERTIA_MIN_VELOCITY;
|
||||
|
||||
if (getAutoRotate() && earth) {
|
||||
earth.rotation.y += CONFIG.rotationSpeed * (deltaTime / 16);
|
||||
targetRotation.y = earth.rotation.y;
|
||||
targetRotation.x = earth.rotation.x;
|
||||
|
||||
// Keep the drag target aligned with autorotation only when the user is not
|
||||
// actively dragging and there is no residual inertial motion to preserve.
|
||||
if (!isDragging && !hasInertia) {
|
||||
targetRotation.y = earth.rotation.y;
|
||||
targetRotation.x = earth.rotation.x;
|
||||
}
|
||||
}
|
||||
|
||||
if (earth) {
|
||||
|
||||
@@ -73,6 +73,19 @@ export function setLoading(loading) {
|
||||
loadingEl.style.display = loading ? "block" : "none";
|
||||
}
|
||||
|
||||
export function setLoadingMessage(title, subtitle = "") {
|
||||
const titleEl = document.getElementById("loading-title");
|
||||
const subtitleEl = document.getElementById("loading-subtitle");
|
||||
|
||||
if (titleEl) {
|
||||
titleEl.textContent = title;
|
||||
}
|
||||
|
||||
if (subtitleEl) {
|
||||
subtitleEl.textContent = subtitle;
|
||||
}
|
||||
}
|
||||
|
||||
// Show tooltip
|
||||
export function showTooltip(x, y, content) {
|
||||
const tooltip = document.getElementById("tooltip");
|
||||
|
||||
Reference in New Issue
Block a user