diff --git a/vehicle-data-platform/apps/web/src/v2/map/FleetMap.test.tsx b/vehicle-data-platform/apps/web/src/v2/map/FleetMap.test.tsx index 038fe9d6..a67c5147 100644 --- a/vehicle-data-platform/apps/web/src/v2/map/FleetMap.test.tsx +++ b/vehicle-data-platform/apps/web/src/v2/map/FleetMap.test.tsx @@ -302,7 +302,7 @@ test('skips unchanged refresh redraws and smoothly moves points without replacin await waitFor(() => { const latest = setData.mock.calls[setData.mock.calls.length - 1]?.[0]; expect(latest?.[0].lnglat).toEqual(wgs84ToGcj02(113.27, 23.13)); - }, { timeout: 1_500 }); + }, { timeout: 1_800 }); expect(setData.mock.calls.length).toBeGreaterThan(dataCalls + 1); expect(setStyle).toHaveBeenCalledTimes(styleCalls); expect(removeLabels).toHaveBeenCalledTimes(removeCalls); @@ -418,8 +418,8 @@ test('renders one selected plate and smoothly follows it until the map is dragge onSelect={() => undefined} /> ); - await waitFor(() => expect(markerSetPosition).toHaveBeenLastCalledWith(wgs84ToGcj02(113.27, 23.14))); - expect(panTo).toHaveBeenLastCalledWith(wgs84ToGcj02(113.27, 23.14), 650); + await waitFor(() => expect(markerSetPosition).toHaveBeenLastCalledWith(wgs84ToGcj02(113.27, 23.14)), { timeout: 1_800 }); + expect(panTo).toHaveBeenLastCalledWith(wgs84ToGcj02(113.27, 23.14), 1_000); expect(setZoomAndCenter).toHaveBeenCalledTimes(1); const follow = screen.getByRole('button', { name: '跟随车辆' }); @@ -440,11 +440,11 @@ test('renders one selected plate and smoothly follows it until the map is dragge onSelect={() => undefined} /> ); - await waitFor(() => expect(markerSetPosition).toHaveBeenLastCalledWith(wgs84ToGcj02(113.29, 23.16))); + await waitFor(() => expect(markerSetPosition).toHaveBeenLastCalledWith(wgs84ToGcj02(113.29, 23.16)), { timeout: 1_800 }); expect(panTo).toHaveBeenCalledTimes(panCountAfterDrag); fireEvent.click(follow); await waitFor(() => expect(follow).toHaveAttribute('aria-pressed', 'true')); - expect(panTo).toHaveBeenLastCalledWith(wgs84ToGcj02(113.29, 23.16), 650); + expect(panTo).toHaveBeenLastCalledWith(wgs84ToGcj02(113.29, 23.16), 1_000); getZoom.mockReturnValue(20); view.rerender( @@ -455,7 +455,7 @@ test('renders one selected plate and smoothly follows it until the map is dragge onSelect={() => undefined} /> ); - await waitFor(() => expect(panTo).toHaveBeenLastCalledWith(wgs84ToGcj02(113.28, 23.15), 650)); + await waitFor(() => expect(panTo).toHaveBeenLastCalledWith(wgs84ToGcj02(113.28, 23.15), 1_000)); expect(setZoomAndCenter).toHaveBeenCalledTimes(1); expect(markerOptions[markerOptions.length - 1]?.content).toContain('is-idle'); diff --git a/vehicle-data-platform/apps/web/src/v2/map/FleetMap.tsx b/vehicle-data-platform/apps/web/src/v2/map/FleetMap.tsx index 311a2833..8238222b 100644 --- a/vehicle-data-platform/apps/web/src/v2/map/FleetMap.tsx +++ b/vehicle-data-platform/apps/web/src/v2/map/FleetMap.tsx @@ -19,7 +19,7 @@ import type { MonitorViewport } from '../hooks/useMonitorData'; const COLORS = ['#12a46f', '#9aa6b7', '#1677ff', '#f59e0b', '#ef4444']; const CLUSTER_VISUAL_CACHE_LIMIT = 256; -const POINT_MOVE_DURATION_MS = 650; +const POINT_MOVE_DURATION_MS = 1_000; const POINT_MOVE_FRAME_MS = 32; const clusterVisualCache = new Map(); @@ -595,10 +595,10 @@ 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, 650); + else mapRef.current.panTo?.(mapPosition, POINT_MOVE_DURATION_MS); centeredVinRef.current = selectedVin; } else if (selectionPositionRef.current && selectionPositionRef.current !== positionKey && followSelectedRef.current) { - mapRef.current.panTo?.(mapPosition, 650); + mapRef.current.panTo?.(mapPosition, POINT_MOVE_DURATION_MS); } const previousPositionKey = selectionPositionRef.current; selectionPositionRef.current = positionKey; @@ -624,7 +624,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), 650); + mapRef.current.panTo?.(wgs84ToGcj02(selectedTarget.longitude, selectedTarget.latitude), POINT_MOVE_DURATION_MS); } };