huweili-cesium 1.2.83 → 1.2.84

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.
Files changed (2) hide show
  1. package/js/labelDiv.js +4 -4
  2. package/package.json +1 -1
package/js/labelDiv.js CHANGED
@@ -150,9 +150,9 @@ export function labelDiv() {
150
150
  ? `${groundLinkLng},${groundLinkLat}`
151
151
  : (info?.flyingHandPosition ?? '--');
152
152
 
153
- // 处理距离(保留1位小数)
154
- const parseDistance = parseFloat(info?.distance);
155
- const distance = !isNaN(parseDistance) ? parseDistance.toFixed(1) : '--';
153
+ // 处理距离(保留1位小数,单位 m 在模板中单独展示)
154
+ const parseDistance = parseFloat(String(info?.distance ?? '').replace(/[^\d.-]/g, ''))
155
+ const distance = Number.isFinite(parseDistance) ? parseDistance.toFixed(1) : '--'
156
156
  const nextInfoText = `${lng}|${lat}|${alt}|${speed}|${flyingHandName}|${flyingHandPhone}|${frequencyBand}|${distance}|${receiveTime}`;
157
157
 
158
158
  if (nextInfoText !== lastInfoText && infoFieldEls) {
@@ -215,7 +215,7 @@ export function labelDiv() {
215
215
  <div class="drone-detail-grid">
216
216
  <div><span class="pilot-title">高度:</span><span class="alt">-</span>m</div>
217
217
  <div><span class="pilot-title">速度:</span><span class="speed">-</span>m/s</div>
218
- <div><span class="pilot-title">距离:</span><span class="distance">200m</span></div>
218
+ <div><span class="pilot-title">距离:</span><span class="distance">-</span>m</div>
219
219
  ${!isUnknown ? '<div><span class="pilot-title">频段:</span><span class="band">2.4GHz、5.8GHz</span></div>' : ''}
220
220
  </div>
221
221
  ${!isUnknown ? `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huweili-cesium",
3
- "version": "1.2.83",
3
+ "version": "1.2.84",
4
4
  "description": "基于 Cesium 的地图工具库(无人机态势、轨迹、围栏、工具栏等)",
5
5
  "type": "module",
6
6
  "main": "./index.js",