@wenle_2523097/agri-map 2.0.7 → 2.0.8

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/dist/index.js CHANGED
@@ -25622,7 +25622,8 @@ var TrackPlayer = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
25622
25622
  onPause = _ref.onPause,
25623
25623
  onStop = _ref.onStop,
25624
25624
  onProgress = _ref.onProgress,
25625
- onComplete = _ref.onComplete;
25625
+ onComplete = _ref.onComplete,
25626
+ onTimelineUpdate = _ref.onTimelineUpdate;
25626
25627
  var map = useMap();
25627
25628
  // ==================== 字段名合并 ====================
25628
25629
  var mergedFieldNames = React.useMemo(function () {
@@ -25757,7 +25758,31 @@ var TrackPlayer = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
25757
25758
  var timestamp = currentPoint[2];
25758
25759
  var formattedTime = timestamp !== null ? formatTime(timestamp) : null;
25759
25760
  onProgress === null || onProgress === void 0 || onProgress(currentIndex, totalPoints, currentPoint, distance, timestamp, formattedTime);
25760
- }, [map, currentIndex, allPoints, createMarkerIcon, onProgress, totalPoints]);
25761
+ // 时间轴进度详细回调
25762
+ if (onTimelineUpdate) {
25763
+ var _allPoints$, _allPoints$at;
25764
+ var startTime = (_allPoints$ = allPoints[0]) === null || _allPoints$ === void 0 ? void 0 : _allPoints$[2];
25765
+ var endTime = (_allPoints$at = allPoints.at(-1)) === null || _allPoints$at === void 0 ? void 0 : _allPoints$at[2];
25766
+ var progress = totalPoints > 1 ? currentIndex / (totalPoints - 1) : 0;
25767
+ var formatTimeStr = function formatTimeStr(ts) {
25768
+ if (ts === null) return null;
25769
+ var d = new Date(ts);
25770
+ return "".concat(String(d.getHours()).padStart(2, '0'), ":").concat(String(d.getMinutes()).padStart(2, '0'), ":").concat(String(d.getSeconds()).padStart(2, '0'));
25771
+ };
25772
+ onTimelineUpdate({
25773
+ currentIndex: currentIndex,
25774
+ totalPoints: totalPoints,
25775
+ progress: progress,
25776
+ startTime: startTime,
25777
+ endTime: endTime,
25778
+ currentTime: timestamp,
25779
+ startTimeStr: formatTimeStr(startTime),
25780
+ endTimeStr: formatTimeStr(endTime),
25781
+ currentTimeStr: formattedTime,
25782
+ distance: distance
25783
+ });
25784
+ }
25785
+ }, [map, currentIndex, allPoints, createMarkerIcon, onProgress, onTimelineUpdate, totalPoints]);
25761
25786
  // 轨迹线(已走过部分用 playPath,未走到部分用 path)
25762
25787
  React.useEffect(function () {
25763
25788
  if (!map || !showTrack || allPoints.length === 0) return;