@aibee/crc-bmap 0.14.23 → 0.14.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/meta.json CHANGED
@@ -5203,7 +5203,7 @@
5203
5203
  "format": "esm"
5204
5204
  },
5205
5205
  "../lib/src/plugins/navigation/position-navigation.js": {
5206
- "bytes": 17071,
5206
+ "bytes": 19582,
5207
5207
  "imports": [
5208
5208
  {
5209
5209
  "path": "../../../node_modules/.pnpm/@swc+helpers@0.5.17/node_modules/@swc/helpers/esm/_extends.js",
@@ -6115,7 +6115,7 @@
6115
6115
  "format": "esm"
6116
6116
  },
6117
6117
  "../lib/src/plugins/car-inertial-position/car-inertial-position.js": {
6118
- "bytes": 17854,
6118
+ "bytes": 18464,
6119
6119
  "imports": [
6120
6120
  {
6121
6121
  "path": "../../../node_modules/.pnpm/@swc+helpers@0.5.17/node_modules/@swc/helpers/esm/_extends.js",
@@ -9929,7 +9929,7 @@
9929
9929
  "bytesInOutput": 13835
9930
9930
  },
9931
9931
  "../lib/src/plugins/navigation/position-navigation.js": {
9932
- "bytesInOutput": 6648
9932
+ "bytesInOutput": 7115
9933
9933
  },
9934
9934
  "../lib/src/plugins/navigation/start-rotate-helper-poi.js": {
9935
9935
  "bytesInOutput": 3438
@@ -9992,7 +9992,7 @@
9992
9992
  "bytesInOutput": 1040
9993
9993
  },
9994
9994
  "../lib/src/plugins/car-inertial-position/car-inertial-position.js": {
9995
- "bytesInOutput": 6612
9995
+ "bytesInOutput": 6826
9996
9996
  },
9997
9997
  "../lib/src/plugins/car-inertial-position/utils.js": {
9998
9998
  "bytesInOutput": 1820
@@ -10046,7 +10046,7 @@
10046
10046
  "bytesInOutput": 0
10047
10047
  }
10048
10048
  },
10049
- "bytes": 439664
10049
+ "bytes": 440345
10050
10050
  }
10051
10051
  }
10052
10052
  }
@@ -24,6 +24,7 @@ export interface NavigationProcessInfo {
24
24
  imageUrl: string | null;
25
25
  nextDir: PathDirection;
26
26
  offsetDistance: number;
27
+ reverseAngle: number | null;
27
28
  }
28
29
  interface PositionNavigationEvent {
29
30
  "navigation-info": {
@@ -47,6 +48,7 @@ export declare class PositionNavigation extends EventDispatcher<PositionNavigati
47
48
  roadData: RoadData2[];
48
49
  paused: boolean;
49
50
  offsetDistance: number;
51
+ actualPosition: [number, number] | null;
50
52
  constructor(navigation: Navigation, options: Partial<PositionNavigationConfig>, roadData: RoadData2[]);
51
53
  get curRoutePath(): PathData2[0] | null;
52
54
  get curRoutePathPoints(): [number, number][];
@@ -85,6 +87,22 @@ export declare class PositionNavigation extends EventDispatcher<PositionNavigati
85
87
  nextAngle: number;
86
88
  nextDir: PathDirection;
87
89
  } | null;
90
+ /**
91
+ * 计算用户实际位置与吸附位置连线相对于当前路线前进方向的夹角
92
+ *
93
+ * 原理:
94
+ * 向量A = 实际位置 - 吸附位置 (吸附位置指向用户实际位置的方向)
95
+ * 向量B = 路线下一个点 - 吸附位置(路线前进方向)
96
+ * 夹角 = 向量A与向量B的夹角(0~180度)
97
+ *
98
+ * 当用户沿路线正向行走时,实际位置在吸附位置的前方,向量A与向量B方向基本一致,夹角接近 0°。
99
+ * 当用户走反方向时(canBack=false,吸附位置不跟随后退),实际位置在吸附位置的后方,
100
+ * 向量A指向路线反方向,夹角接近 180°,据此判断需要提示掉头。
101
+ *
102
+ * @param actualPos 可选,用户实际位置;不传则使用上次 toPosition 保存的值
103
+ * @returns 夹角(0~180度),null 表示无法计算(路线数据不足或位置重合)
104
+ */
105
+ calcReverseAngle(actualPos?: [number, number]): number | null;
88
106
  getCurPointAreaInfo(): {
89
107
  id: string;
90
108
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aibee/crc-bmap",
3
- "version": "0.14.23",
3
+ "version": "0.14.24",
4
4
  "description": "",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "lib/index.esm.min.js",