기록 재생 중 자동 갱신 리셋 방지
This commit is contained in:
+16
-6
@@ -1964,14 +1964,20 @@ function startHistoryPlayback(speed) {
|
||||
|
||||
let tick = 0;
|
||||
mapState.playbackTimer = setInterval(() => {
|
||||
const index = Math.min(mapState.playbackIndex || 0, points.length - 1);
|
||||
const point = points[index];
|
||||
const currentPoints = mapState.historyPoints || [];
|
||||
if (!currentPoints.length) {
|
||||
stopHistoryPlayback();
|
||||
return;
|
||||
}
|
||||
|
||||
const index = Math.min(mapState.playbackIndex || 0, currentPoints.length - 1);
|
||||
const point = currentPoints[index];
|
||||
moveSelectedHistoryPoint(index, false);
|
||||
if (tick % 8 === 0) mapState.map.panTo(point.latlng);
|
||||
|
||||
const nextIndex = index + speed;
|
||||
if (nextIndex >= points.length) {
|
||||
moveSelectedHistoryPoint(points.length - 1, false);
|
||||
if (nextIndex >= currentPoints.length) {
|
||||
moveSelectedHistoryPoint(currentPoints.length - 1, false);
|
||||
stopHistoryPlayback();
|
||||
return;
|
||||
}
|
||||
@@ -2272,9 +2278,13 @@ function applyHistoryCounts(data) {
|
||||
|
||||
function renderHistoryPoints(rawPoints) {
|
||||
if (!mapState.map || !rawPoints?.length) return;
|
||||
const keepPlaybackIndex = !!mapState.playbackTimer;
|
||||
const previousPlaybackIndex = Number.isFinite(mapState.playbackIndex) ? mapState.playbackIndex : 0;
|
||||
const points = filterHistoryOutliers(rawPoints);
|
||||
mapState.historyPoints = points;
|
||||
mapState.playbackIndex = 0;
|
||||
mapState.playbackIndex = keepPlaybackIndex
|
||||
? Math.max(0, Math.min(points.length - 1, previousPlaybackIndex))
|
||||
: 0;
|
||||
drawSpeedTrack(points);
|
||||
mapState.stayPoints = buildStayPoints(points);
|
||||
mapState.homeStats = buildHomeStats(points);
|
||||
@@ -2360,7 +2370,7 @@ function renderHistoryPoints(rawPoints) {
|
||||
mapState.historyBoundsFitted = true;
|
||||
}
|
||||
|
||||
if (!_overrideRange && !mapState.initialInfoOpened && mapState.historyEndMarker?.infoWindow) {
|
||||
if (!_overrideRange && !keepPlaybackIndex && !mapState.initialInfoOpened && mapState.historyEndMarker?.infoWindow) {
|
||||
mapState.historyEndMarker.infoWindow.open(mapState.map, mapState.historyEndMarker);
|
||||
mapState.openInfoWindow = mapState.historyEndMarker.infoWindow;
|
||||
mapState.initialInfoOpened = true;
|
||||
|
||||
Reference in New Issue
Block a user