地图优化

This commit is contained in:
cwchen 2026-01-15 15:34:36 +08:00
parent b935891fda
commit c40e75725b
2 changed files with 5 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 760 B

After

Width:  |  Height:  |  Size: 743 B

View File

@ -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(() => {