diff --git a/src/static/image/real_postion.png b/src/static/image/real_postion.png index 9c18627..ac9c5ed 100644 Binary files a/src/static/image/real_postion.png and b/src/static/image/real_postion.png differ diff --git a/src/static/map.html b/src/static/map.html index 55760cf..0f54d43 100644 --- a/src/static/map.html +++ b/src/static/map.html @@ -1616,8 +1616,8 @@ } // 根据移动状态动态调整历史记录大小 - // 移动时使用更多样本(10个)进行更强的平滑,静止时使用较少样本(5个)保持响应性 - const targetHistorySize = this.isMoving ? 10 : 5; + // 移动时使用更多样本进行更强的平滑,静止时使用中等平滑保持稳定 + const targetHistorySize = this.isMoving ? 15 : 7; if (!this.headingHistorySize) { this.headingHistorySize = targetHistorySize; } else { @@ -1632,7 +1632,7 @@ } // 如果历史记录不足,直接返回原始值 - const minHistorySize = this.isMoving ? 5 : 3; // 移动时需要更多样本 + const minHistorySize = this.isMoving ? 7 : 4; // 移动时需要更多样本,静止时也稍微增加样本数 if (this.headingHistory.length < minHistorySize) { return rawHeading; } @@ -1796,12 +1796,11 @@ const oldHeading = this.state.currentHeading; const diff = Math.abs(this.angleDifference(newHeading, oldHeading)); - // 移动时1.5度,静止时0.3度,极高灵敏度 - const threshold = this.isMoving ? 1.5 : 0.3; + // 阈值加大:移动时 3°,静止时 1°,进一步抑制小抖动 + const threshold = this.isMoving ? 3 : 1; if (diff >= threshold || oldHeading === 0) { this.state.currentHeading = newHeading; - console.log('方向更新:', newHeading.toFixed(1), '度', '变化:', diff.toFixed(1), '度', this.isMoving ? '(移动中)' : '(静止)'); if (this.state.currentLocation) { requestAnimationFrame(() => {