tune(monitor): extend point motion to five seconds

This commit is contained in:
lingniu
2026-07-16 09:41:08 +08:00
parent 26a0599611
commit 3bbae099bc
2 changed files with 18 additions and 7 deletions

View File

@@ -19,8 +19,9 @@ import type { MonitorViewport } from '../hooks/useMonitorData';
const COLORS = ['#12a46f', '#9aa6b7', '#1677ff', '#f59e0b', '#ef4444'];
const CLUSTER_VISUAL_CACHE_LIMIT = 256;
const POINT_MOVE_DURATION_MS = 1_000;
const POINT_MOVE_FRAME_MS = 32;
const POINT_MOVE_DURATION_MS = 5_000;
const POINT_MOVE_FRAME_MS = 50;
const MAP_INTERACTION_PAN_DURATION_MS = 650;
const clusterVisualCache = new Map<number, { diameter: number; url: string }>();
function dotDataUrl(color: string) {
@@ -595,7 +596,7 @@ export function FleetMap({ vehicles, selectedVin, onSelect, monitorMap, onSelect
setFollowSelected(true);
const currentZoom = mapRef.current.getZoom?.() ?? 15;
if (currentZoom < 15) mapRef.current.setZoomAndCenter?.(15, mapPosition);
else mapRef.current.panTo?.(mapPosition, POINT_MOVE_DURATION_MS);
else mapRef.current.panTo?.(mapPosition, MAP_INTERACTION_PAN_DURATION_MS);
centeredVinRef.current = selectedVin;
} else if (selectionPositionRef.current && selectionPositionRef.current !== positionKey && followSelectedRef.current) {
mapRef.current.panTo?.(mapPosition, POINT_MOVE_DURATION_MS);
@@ -624,7 +625,7 @@ export function FleetMap({ vehicles, selectedVin, onSelect, monitorMap, onSelect
followSelectedRef.current = next;
setFollowSelected(next);
if (next && selectedTarget && mapRef.current) {
mapRef.current.panTo?.(wgs84ToGcj02(selectedTarget.longitude, selectedTarget.latitude), POINT_MOVE_DURATION_MS);
mapRef.current.panTo?.(wgs84ToGcj02(selectedTarget.longitude, selectedTarget.latitude), MAP_INTERACTION_PAN_DURATION_MS);
}
};