release: bump version to 0.40.4

This commit is contained in:
rayd1o
2026-04-26 01:41:29 +08:00
parent 229be0bced
commit 5f47ec1659
8 changed files with 83 additions and 26 deletions

View File

@@ -1 +1 @@
0.40.3 0.40.4

View File

@@ -10,6 +10,18 @@ This project follows the repository versioning rule:
## [0.39.0] — 2026-04-24 ## [0.39.0] — 2026-04-24
## [0.40.4] — 2026-04-26
### 🔧 Improvements
- 新增页面可见性恢复处理,页面从后台切回前台时主动刷新卫星位置,避免累积后台时间在下一帧一次性回放
- 抽出卫星轨迹状态与轨迹几何清理 helper统一后台恢复与清空数据时的轨迹重置路径
### 🐛 Fixes
- 修复页面在后台停留较久后恢复前台时,卫星轨迹因超大 `deltaTime` 突然跳变、拖尾异常拉长的问题
- 修复后台恢复后首帧仍沿用旧轨迹缓存,导致轨迹与当前卫星位置短时错位的问题
---
## [0.40.3] — 2026-04-25 ## [0.40.3] — 2026-04-25
### 🔧 Improvements ### 🔧 Improvements

View File

@@ -16,12 +16,13 @@
## Current Version ## Current Version
- `main` 当前主线历史推导到:`0.16.5` - `main` 当前主线历史推导到:`0.16.5`
- `dev` 当前开发分支历史推导到:`0.40.3` - `dev` 当前开发分支历史推导到:`0.40.4`
## Timeline ## Timeline
| Version | Type | Branch | Commit | Summary | | Version | Type | Branch | Commit | Summary |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| `0.40.4` | bugfix | `dev` | `pending` | 修复页面后台恢复后卫星轨迹跳变与位置错位,统一轨迹重置路径 |
| `0.40.3` | improvement | `dev` | `pending` | 卫星点云升级 ShaderMaterial修复锁定环 depthTest 与位置漂移,新增悬停态缩放 | | `0.40.3` | improvement | `dev` | `pending` | 卫星点云升级 ShaderMaterial修复锁定环 depthTest 与位置漂移,新增悬停态缩放 |
| `0.40.2` | improvement | `dev` | `pending` | 卫星点大小随镜头缩放动态调整,调小默认基础尺寸 | | `0.40.2` | improvement | `dev` | `pending` | 卫星点大小随镜头缩放动态调整,调小默认基础尺寸 |
| `0.40.1` | improvement | `dev` | `pending` | 卫星选中标记配色跟随图例,修复 footprint 遮蔽卫星渲染问题,修复选中海缆误触发卫星高亮 | | `0.40.1` | improvement | `dev` | `pending` | 卫星选中标记配色跟随图例,修复 footprint 遮蔽卫星渲染问题,修复选中海缆误触发卫星高亮 |

View File

@@ -1,6 +1,6 @@
{ {
"name": "planet-frontend", "name": "planet-frontend",
"version": "0.40.3", "version": "0.40.4",
"private": true, "private": true,
"packageManager": "bun@1", "packageManager": "bun@1",
"dependencies": { "dependencies": {

View File

@@ -242,6 +242,7 @@ let activeTouchPoints = new Map();
let pinchGesture = null; let pinchGesture = null;
let pointerDragDistance = 0; let pointerDragDistance = 0;
let suppressNextClick = false; let suppressNextClick = false;
let shouldRefreshSatellitesAfterVisibilityResume = false;
const clock = new THREE.Clock(); const clock = new THREE.Clock();
const interactionRaycaster = new THREE.Raycaster(); const interactionRaycaster = new THREE.Raycaster();
@@ -2392,6 +2393,7 @@ export async function setSatellitesEnabled(
function setupEventListeners() { function setupEventListeners() {
const handleResize = () => onWindowResize(); const handleResize = () => onWindowResize();
const handleVisibilityChange = () => onVisibilityChange();
const handlePointerMove = (event) => onPointerMove(event); const handlePointerMove = (event) => onPointerMove(event);
const handlePointerDown = (event) => onPointerDown(event); const handlePointerDown = (event) => onPointerDown(event);
const handlePointerUp = (event) => onPointerUp(event); const handlePointerUp = (event) => onPointerUp(event);
@@ -2403,6 +2405,7 @@ function setupEventListeners() {
const handleInfoCardDrag = () => repositionCruiseConnector(); const handleInfoCardDrag = () => repositionCruiseConnector();
bindListener(window, "resize", handleResize); bindListener(window, "resize", handleResize);
bindListener(document, "visibilitychange", handleVisibilityChange);
bindListener(window, "pagehide", handlePageHide); bindListener(window, "pagehide", handlePageHide);
bindListener(window, "beforeunload", handlePageHide); bindListener(window, "beforeunload", handlePageHide);
bindListener(window, "earth:rotation-mode-change", handleRotationMode); bindListener(window, "earth:rotation-mode-change", handleRotationMode);
@@ -2425,6 +2428,20 @@ function setupEventListeners() {
} }
} }
function onVisibilityChange() {
if (document.hidden) {
shouldRefreshSatellitesAfterVisibilityResume = true;
return;
}
if (!shouldRefreshSatellitesAfterVisibilityResume) return;
shouldRefreshSatellitesAfterVisibilityResume = false;
// Drop the elapsed background time so the next RAF does not replay it.
clock.getDelta();
updateSatellitePositions(0, true, { resetTrails: true });
}
function updateHudScale() { function updateHudScale() {
const widthScale = window.innerWidth / HUD_CONFIG.scaleReferenceWidth; const widthScale = window.innerWidth / HUD_CONFIG.scaleReferenceWidth;
const heightScale = window.innerHeight / HUD_CONFIG.scaleReferenceHeight; const heightScale = window.innerHeight / HUD_CONFIG.scaleReferenceHeight;

View File

@@ -68,6 +68,7 @@ const SATELLITE_CONSTELLATION_LABELS = Object.freeze({
const TRAIL_LENGTH = SATELLITE_CONFIG.trailLength; const TRAIL_LENGTH = SATELLITE_CONFIG.trailLength;
const DOT_TEXTURE_SIZE = 32; const DOT_TEXTURE_SIZE = 32;
const POSITION_UPDATE_INTERVAL_MS = 250; const POSITION_UPDATE_INTERVAL_MS = 250;
const BACKGROUND_TRAIL_RESET_DELTA_MS = 2000;
const DIMMED_SATELLITE_BRIGHTNESS = 0.42; const DIMMED_SATELLITE_BRIGHTNESS = 0.42;
const DIMMED_SATELLITE_TRAIL_BRIGHTNESS = 0.24; const DIMMED_SATELLITE_TRAIL_BRIGHTNESS = 0.24;
const DIMMED_SATELLITE_POINT_OPACITY = 0.62; const DIMMED_SATELLITE_POINT_OPACITY = 0.62;
@@ -556,6 +557,34 @@ function createSatellitePositionState() {
}; };
} }
function resetSatelliteTrailState() {
satellitePositions.forEach((position) => {
position.trail = [];
position.trailIndex = 0;
position.trailCount = 0;
});
}
function clearSatelliteTrailGeometry() {
if (!satelliteTrails) return;
const trailPositionAttr = satelliteTrails.geometry.attributes.position;
const trailColorAttr = satelliteTrails.geometry.attributes.color;
if (trailPositionAttr?.array) {
trailPositionAttr.array.fill(0);
trailPositionAttr.needsUpdate = true;
}
if (trailColorAttr?.array) {
trailColorAttr.array.fill(0);
trailColorAttr.needsUpdate = true;
}
}
function clearSatelliteTrails() {
resetSatelliteTrailState();
clearSatelliteTrailGeometry();
}
function ensureSatelliteCapacity(count) { function ensureSatelliteCapacity(count) {
if (!satellitePoints || !satelliteBackdropPoints || !satelliteTrails) return; if (!satellitePoints || !satelliteBackdropPoints || !satelliteTrails) return;
@@ -925,18 +954,29 @@ export async function loadSatellites(options = {}) {
}; };
} }
export function updateSatellitePositions(deltaTime = 0, force = false) { export function updateSatellitePositions(deltaTime = 0, force = false, options = {}) {
if (!satellitePoints || !satelliteBackdropPoints || satelliteData.length === 0) return; if (!satellitePoints || !satelliteBackdropPoints || satelliteData.length === 0) return;
const shouldUpdateTrails = const shouldUpdateTrails =
showSatellites || showTrails || lockedSatelliteIndex !== null; showSatellites || showTrails || lockedSatelliteIndex !== null;
const shouldResetTrails =
options.resetTrails ||
(!force && deltaTime >= BACKGROUND_TRAIL_RESET_DELTA_MS);
if (shouldResetTrails) {
clearSatelliteTrails();
positionUpdateAccumulator = POSITION_UPDATE_INTERVAL_MS;
} else {
positionUpdateAccumulator += deltaTime; positionUpdateAccumulator += deltaTime;
}
if (!force && positionUpdateAccumulator < POSITION_UPDATE_INTERVAL_MS) { if (!force && positionUpdateAccumulator < POSITION_UPDATE_INTERVAL_MS) {
return; return;
} }
const elapsedMs = Math.max( const elapsedMs = shouldResetTrails
? 0
: Math.max(
positionUpdateAccumulator, positionUpdateAccumulator,
POSITION_UPDATE_INTERVAL_MS, POSITION_UPDATE_INTERVAL_MS,
); );
@@ -2384,10 +2424,8 @@ export function clearSatelliteData() {
satellitePositions.forEach((position) => { satellitePositions.forEach((position) => {
position.current.set(0, 0, 0); position.current.set(0, 0, 0);
position.trail = [];
position.trailIndex = 0;
position.trailCount = 0;
}); });
resetSatelliteTrailState();
if (satellitePoints) { if (satellitePoints) {
const positionAttr = satellitePoints.geometry.attributes.position; const positionAttr = satellitePoints.geometry.attributes.position;
@@ -2424,18 +2462,7 @@ export function clearSatelliteData() {
satelliteBackdropPoints.geometry.setDrawRange(0, 0); satelliteBackdropPoints.geometry.setDrawRange(0, 0);
} }
if (satelliteTrails) { clearSatelliteTrailGeometry();
const trailPositionAttr = satelliteTrails.geometry.attributes.position;
const trailColorAttr = satelliteTrails.geometry.attributes.color;
if (trailPositionAttr?.array) {
trailPositionAttr.array.fill(0);
trailPositionAttr.needsUpdate = true;
}
if (trailColorAttr?.array) {
trailColorAttr.array.fill(0);
trailColorAttr.needsUpdate = true;
}
}
hideHoverRings(); hideHoverRings();
hideLockedRing(); hideLockedRing();

View File

@@ -1,6 +1,6 @@
[project] [project]
name = "planet" name = "planet"
version = "0.40.3" version = "0.40.4"
description = "智能星球计划 - 态势感知系统" description = "智能星球计划 - 态势感知系统"
requires-python = ">=3.14" requires-python = ">=3.14"
dependencies = [ dependencies = [

2
uv.lock generated
View File

@@ -475,7 +475,7 @@ wheels = [
[[package]] [[package]]
name = "planet" name = "planet"
version = "0.40.3" version = "0.40.4"
source = { virtual = "." } source = { virtual = "." }
dependencies = [ dependencies = [
{ name = "aiofiles" }, { name = "aiofiles" },