feat: 跟随式导航(已走变灰 / 方向朝上 / 锁下方 / 偏航重算 / 拖动后返回导航)

前端实现(接口只提供折线与距离时间):
- 已走 / 剩余分段上色:按当前位置在折线上的投影切分,已走 #9E9E9E,
  剩余白描边 + #0A84FF 主线
- 行进方向朝上 + 当前位置压在屏幕下方约 74%:setHeading + setCenter + panBy;
  setHeading 不生效的环境(实测 headless WebGL 调完 getHeading 仍为 0)自动
  降级为「正北朝上」,只在控制台提示一次
- 偏航重算:离路线 >60 米触发 /api/nav_route 重算,12 秒冷却;
  阈值放宽是因为百度会把起点吸附到最近道路,和真实 GPS 天然差 20~50 米
- 拖动地图进入自由查看:显示「返回导航」胶囊,8 秒无操作自动回正
- 到达判定改用「到终点的真实距离 <25 米」,不再按进度比例(GPS 跳点会误判)
- 定位坐标系修正:navigator.geolocation 给的是 WGS84,先 wgs84->gcj02 再算投影,
  否则整体偏 500 米会一直判定偏航

UI:
- 导航信息条与后台「步行路线 AK」弹窗的 emoji 全部换成 inline SVG
- 新增「返回导航」胶囊样式
This commit is contained in:
zzy
2026-11-14 21:32:04 +08:00
parent bd147e9f4b
commit 75f040d90a
4 changed files with 348 additions and 77 deletions
+22
View File
@@ -2790,3 +2790,25 @@
font-size: 12.5px;
font-weight: 600;
}
/* 拖动地图后的「返回导航」胶囊 */
.nav-resume {
position: fixed;
left: 50%;
transform: translateX(-50%);
bottom: calc(150px + env(safe-area-inset-bottom, 0px));
z-index: 270;
display: inline-flex;
align-items: center;
gap: 6px;
padding: 9px 16px;
border: none;
border-radius: 999px;
background: #0A84FF;
color: #fff;
font-size: 13px;
font-weight: 600;
box-shadow: 0 6px 20px rgba(10, 132, 255, 0.45);
}
.nav-resume[hidden] { display: none; }
.nav-banner-icon { display: inline-flex; align-items: center; color: #0A84FF; }